* Added Authentication

This commit is contained in:
2025-02-21 09:59:50 +01:00
parent ed5b5634fd
commit 6774311433
20 changed files with 468 additions and 30 deletions

View File

@@ -56,6 +56,20 @@ public class UserService(OrdersManagementDbContext context, IMapper mapper) : IU
context.Users.Update(user);
return await context.SaveChangesAsync();
}
public async Task<int> Login(UserDto userDto)
{
User? user = context.Users.FirstOrDefault(x => x.Id == userDto.Id);
if (user is null) return 0;
user.LastLoginDate = DateTime.Now;
user.FailedLoginAttempts = 0;
context.Users.Update(user);
return await context.SaveChangesAsync();
}
public async Task<int> Delete(Guid id)
{