User dolgok javítása

This commit is contained in:
2025-03-15 14:27:08 +01:00
parent 2d13b0909e
commit 8793a1c77c
4 changed files with 89 additions and 5 deletions
@@ -9,8 +9,21 @@ namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface IUserService
{
Task<UserDTO> GetUser(int Id);
Task<UserDTO> GetUserAsync(int Id);
Task<List<UserDTO>> GetAllUserAsync();
Task<UserDTO> UpdateUserAsync(UserDTO userDTO);
Task<UserDTO> Authenticate(string UserName, string Password);
Task<RoleDTO> GetRoleAsync(int Id);
Task<List<RoleDTO>> GetAllRoleAsync();
Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO);
Task<UserRoleDTO> GetUserRoleAsync(int Id);
Task<List<UserRoleDTO>> GetAllUserRoleAsync();
Task<UserRoleDTO> UpdateUserRoleAsync(RoleDTO roleDTO);
string GenerateJwtToken(UserDTO userDTO);
}
}
+34 -2
View File
@@ -30,7 +30,7 @@ namespace WorkFlowCheck.BL.Services
_mapper = mapper;
_configuration = configuration;
}
public async Task<UserDTO> GetUser(int Id)
public async Task<UserDTO> GetUserAsync(int Id)
{
var retVal = new UserDTO() { RoleDTO = new List<RoleDTO>() };
@@ -48,7 +48,31 @@ namespace WorkFlowCheck.BL.Services
}
return retVal;
}
public async Task<List<UserDTO>> GetAllUserAsync()
{
var retVal = new List<UserDTO>
{
new UserDTO
{
RoleDTO = new List<RoleDTO>()
}
};
try
{
var users = await _dbContext.Users.ToListAsync();
if (users != null)
{
retVal = _mapper.Map<List<UserDTO>>(users);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<UserDTO> Authenticate(string userName, string password)
{
var retVal = new UserDTO() { RoleDTO = new List<RoleDTO>() };
@@ -120,5 +144,13 @@ namespace WorkFlowCheck.BL.Services
return new JwtSecurityTokenHandler().WriteToken(token);
}
public Task<UserDTO> UpdateUserAsync(UserDTO userDTO) => throw new NotImplementedException();
public Task<RoleDTO> GetRoleAsync(int Id) => throw new NotImplementedException();
public Task<List<RoleDTO>> GetAllRoleAsync() => throw new NotImplementedException();
public Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO) => throw new NotImplementedException();
Task<UserRoleDTO> IUserService.GetUserRoleAsync(int Id) => throw new NotImplementedException();
public Task<List<UserRoleDTO>> GetAllUserRoleAsync() => throw new NotImplementedException();
public Task<UserRoleDTO> UpdateUserRoleAsync(RoleDTO roleDTO) => throw new NotImplementedException();
}
}