Beispiel #1
0
        public async Task <IHttpActionResult> GetNear()
        {
            var userId      = long.Parse(User.Identity.GetUserId());
            var userProfile = await _repository.GetProfile(userId);

            if (userProfile == null)
            {
                return(ErrorApiResult(1000, "Профиль не найден"));
            }

            var wishesNear = await _wishRepository.GetByArea(userProfile.Country, userProfile.City);

            var giftsNear = await _giftRepository.GetByArea(userProfile.Country, userProfile.City);

            var profilesNear = await _repository.GetByArea(userProfile.Country, userProfile.City);

            return(SuccessApiResult(new InterestingNearDto()
            {
                Gifts = giftsNear.ToList(),
                Users = profilesNear.ToList(),
                Wishes = wishesNear.ToList()
            }));
        }