From e3acc0c4884c494d0cd8fb87c0fa8f6299790d8d Mon Sep 17 00:00:00 2001 From: Piotr Kus Date: Fri, 31 Jan 2025 10:13:37 +0100 Subject: [PATCH] * Added handling Login and User creation to LoginService --- SytelineSaAppEfDataModel/Services/LoginService.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SytelineSaAppEfDataModel/Services/LoginService.cs b/SytelineSaAppEfDataModel/Services/LoginService.cs index 8d7340c..0bd8273 100644 --- a/SytelineSaAppEfDataModel/Services/LoginService.cs +++ b/SytelineSaAppEfDataModel/Services/LoginService.cs @@ -1,11 +1,12 @@ using AutoMapper; +using SytelineSaAppEfDataModel.Dtos; using SytelineSaAppEfDataModel.Entities; namespace SytelineSaAppEfDataModel.Services; public class LoginService(SytelineSaAppDbContext context, IMapper mapper) : ILoginService { - public async EdiUserd CreateUser(string userName, string password) + public async Task CreateUser(string userName, string password) { EdiUser user = new EdiUser() { @@ -16,11 +17,11 @@ public class LoginService(SytelineSaAppDbContext context, IMapper mapper) : ILog context.EdiUsers.Add(user); await context.SaveChangesAsync(); - return + return mapper.Map(user); } - - public bool Login(string userName, string password) + + public Task Login(string userName, string password) { - + return Task.FromResult(context.EdiUsers.Any(u => u.Login == userName && u.Password == password)); } } \ No newline at end of file