/// <summary> /// get user by id /// </summary> /// <param name="id"></param> /// <returns></returns> public UserDTO GetUserById(int id) { using (_queryableUnitOfWork) { // 1. Pass value to repository and use linq specifications //var user = _userRepository.GetUserById(1); // 2. create specifications in service and use var specification = UserSpecifications.UserIdEquals(id); var user2 = _userRepository.AllMatching(specification).FirstOrDefault(); return(UserAdapter.AdaptToUserDto(user2)); } }