Reformat UserName to Username, Added DAL with admin login method
This commit is contained in:
14
DataAccessLayer/DataAccessLayer.csproj
Normal file
14
DataAccessLayer/DataAccessLayer.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>DAL</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\pac-man-board-game\pac-man-board-game.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
26
DataAccessLayer/Database/Service/UserService.cs
Normal file
26
DataAccessLayer/Database/Service/UserService.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using pacMan.GameStuff;
|
||||
using pacMan.GameStuff.Items;
|
||||
|
||||
namespace DAL.Database.Service;
|
||||
|
||||
public class UserService
|
||||
{
|
||||
private readonly List<Player> _users = new()
|
||||
{
|
||||
new Player
|
||||
{
|
||||
Username = "admin",
|
||||
Colour = "red",
|
||||
PacMan = new Character
|
||||
{
|
||||
Colour = "red",
|
||||
Type = CharacterType.PacMan
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public async Task<IPlayer?> Login(string username, string password)
|
||||
{
|
||||
return await Task.Run(() => _users.FirstOrDefault(x => x.Username == username && password == "admin"));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user