* Added EdiUser Entity and DTO
* Added LoginService to handle login and user creation * Extended DbContext * Extended Mapper
This commit is contained in:
10
SytelineSaAppEfDataModel/Services/ILoginService.cs
Normal file
10
SytelineSaAppEfDataModel/Services/ILoginService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using SytelineSaAppEfDataModel.Dtos;
|
||||
|
||||
namespace SytelineSaAppEfDataModel.Services;
|
||||
|
||||
public interface ILoginService
|
||||
{
|
||||
Task<EdiUserDto> CreateUser(string userName, string password);
|
||||
Task<bool> Login(string username, string password);
|
||||
|
||||
}
|
||||
26
SytelineSaAppEfDataModel/Services/LoginService.cs
Normal file
26
SytelineSaAppEfDataModel/Services/LoginService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using AutoMapper;
|
||||
using SytelineSaAppEfDataModel.Entities;
|
||||
|
||||
namespace SytelineSaAppEfDataModel.Services;
|
||||
|
||||
public class LoginService(SytelineSaAppDbContext context, IMapper mapper) : ILoginService
|
||||
{
|
||||
public async EdiUserd CreateUser(string userName, string password)
|
||||
{
|
||||
EdiUser user = new EdiUser()
|
||||
{
|
||||
Login = userName,
|
||||
Password = password,
|
||||
};
|
||||
|
||||
context.EdiUsers.Add(user);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
public bool Login(string userName, string password)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user