Пример #1
0
 public GetUserDetailsResponse GetUserDetails(ISession session, GetUserDetailsRequest request)
 {
     var response = request.CreateResponse<GetUserDetailsResponse>();
     using (var uow = UnitOfWorkFactory.Create())
     {
         Specification<User> spec = null;
         if (request.UserId != 0)
         {
             spec = UserSpecification.Id(request.UserId);
         }
         else if (!string.IsNullOrEmpty(request.Name))
         {
             spec = UserSpecification.Name(request.Name);
         }
         else
         {
             return response; //invalid request
         }
         
         var user = uow.UsersRepository.FirstMatching(spec);
         if (user != null)
         {
             response.User = user.ProjectedAs<UserDto>();
             response.IsFriend = session.User.Friends.Any(p => p.Id == user.Id);
             response.IsInBlacklist = session.User.PersonalBlackList.Any(p => p.Id == user.Id);
             
             uow.Attach(session.User);
         }
     }
     return response;
 }
		public Task<GetUserDetailsResponse> GetUserDetails(GetUserDetailsRequest request)
		{
			return ConnectionManager.SendRequestAndWaitResponse<GetUserDetailsResponse>(request);
		}