Reformat UserName to Username, Added DAL with admin login method

This commit is contained in:
Martin Berg Alstad
2023-07-19 23:25:54 +02:00
parent 8f4e8ed481
commit 745f292eee
18 changed files with 277 additions and 232 deletions

View 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>

View 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"));
}
}