示例#1
0
        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));
        }
示例#2
0
 public Result <IEnumerable <UserDto> > Handle(GetAllUsers query)
 {
     return(Result.Success(_userRepository.GetUsers()
                           .Select(user => DomainToDtoConverters.ConvertToUserDto(user))));
 }