예제 #1
0
        public GetUserResponseDto GetAllUser()
        {
            var response = new GetUserResponseDto();

            response.Users = _iPmsLogic.GetAllUser();
            return(response);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
 public async Task <GetUserResponseDto> GetOneByIdAsync(int id)
 {
     return(GetUserResponseDto.FromUser(await userRepository.FindOneByIdAsync(id)));
 }
예제 #5
0
        public async Task <IEnumerable <GetUserResponseDto> > GetAllAsync()
        {
            var users = await userRepository.GetAllAsync();

            return(users.Select(x => GetUserResponseDto.FromUser(x)));
        }