Example #1
0
        public async Task AddCompositePropertiesToDiscountDTOAsync(int userId, DiscountDTO discountDTO, Point location)
        {
            var assessment = await _discountRepository.GetUserAssessmentAsync(discountDTO.DiscountId, userId);

            var(Address, Distance) = await _discountRepository.GetAddressAndDistanceToClosestPointOfSaleAsync(discountDTO.DiscountId, location);

            discountDTO.DiscountRating = await _discountRepository.GetDiscountRatingAsync(discountDTO.DiscountId);

            discountDTO.Tags = await _discountRepository.GetDiscountTagsAsync(discountDTO.DiscountId);

            discountDTO.IsSaved = await _discountRepository.IsSavedDiscountAsync(discountDTO.DiscountId, userId);

            discountDTO.IsOrdered = await _discountRepository.IsOrderedDiscountAsync(discountDTO.DiscountId, userId);

            discountDTO.AssessmentValue  = assessment?.AssessmentValue;
            discountDTO.Address          = Address;
            discountDTO.DistanceInMeters = Distance;
        }