public GetUserResponseDto GetAllUser() { var response = new GetUserResponseDto(); response.Users = _iPmsLogic.GetAllUser(); return(response); }
public async Task <GetUserResponseDto> DeleteOneByIdAsync(int id) { var foundItem = await userRepository.FindOneByIdAsync(id); if (foundItem == null) { throw new NotFoundException($"User with id={id} was not found"); } var deletedItem = await userRepository.DeleteOneAsync(foundItem); return(GetUserResponseDto.FromUser(deletedItem)); }
public async Task <GetUserResponseDto> GetOneByStudentCodeAsync(string code) { try { var foundUser = await userRepository.GetOneByStudentCodeAsync(code); if (foundUser == null) { throw new NotFoundException($"User with code={code} was not found"); } return(GetUserResponseDto.FromUser(foundUser)); } catch (Exception e) { return(null); } }
public async Task <GetUserResponseDto> GetOneByIdAsync(int id) { return(GetUserResponseDto.FromUser(await userRepository.FindOneByIdAsync(id))); }
public async Task <IEnumerable <GetUserResponseDto> > GetAllAsync() { var users = await userRepository.GetAllAsync(); return(users.Select(x => GetUserResponseDto.FromUser(x))); }