예제 #1
0
        public static FriendMobileSearchCriteria ToSearchCriteria(this FriendSearchCriteriaBindingModel model, int userId)
        {
            FriendMobileSearchCriteria criteria = CreateSearchCriteria <FriendMobileSearchCriteria>(model);

            criteria.UserId = userId;

            return(criteria);
        }
        public IHttpActionResult FetchFriends([FromUri] FriendSearchCriteriaBindingModel model)
        {
            User user = GetCurrentUser();

            FriendMobileSearchCriteria friendMobileSearchCriteria = model.ToSearchCriteria(user.Id);

            IQueryResult <User> carts = FriendService.Obj.Find(friendMobileSearchCriteria);

            var result = new PagingBindingModel <UserProfileBindingModel>()
            {
                Items      = carts.Items.Select(x => x.ToUserProfileBindingModel()).ToList(),
                TotalCount = carts.TotalCount
            };

            foreach (var userBindingModel in result.Items.ToList())
            {
                userBindingModel.PhotoId = ImageService.Obj.FindByUserId(userBindingModel.UserId)?.ImageId;
            }

            return(Ok(result));
        }