public Result <UserDto> Handle(GetUserById query) { User user = _userRepository.GetUserById(query.UserId); if (user == null) { return(Result.Failure <UserDto>($"Could not find user ({ query.UserId })")); } UserDto userDto = DomainToDtoConverters.ConvertToUserDto(user); return(Result.Success(userDto)); }
public Result <IEnumerable <UserDto> > Handle(GetAllUsers query) { return(Result.Success(_userRepository.GetUsers() .Select(user => DomainToDtoConverters.ConvertToUserDto(user)))); }