Пример #1
0
        public SlimAccommodation CreateSlim(Accommodation accommodation, string languageCode)
        {
            var id           = accommodation.Id.ToString();
            var location     = GetSlimLocation(accommodation, languageCode);
            var name         = GetName(accommodation, languageCode);
            var firstImage   = GetFirstImage(accommodation, languageCode);
            var rating       = AccommodationRatingConverter.Convert(accommodation.Rating);
            var propertyType = (PropertyTypes)accommodation.PropertyType;

            return(new SlimAccommodation(id, location, name, firstImage, rating, propertyType));
        }
Пример #2
0
        private IQueryable <Accommodation> GetAvailableAccommodations(AvailabilityRequest availabilityRequest)
        {
            var roomTypes = GetRoomTypes(availabilityRequest);
            var ratings   = AccommodationRatingConverter.Convert(availabilityRequest.Ratings);

            return(_dbContext.ContractAccommodationRelations
                   .IncludeAllocationRequirements(availabilityRequest)
                   .IncludeAvailabilityRestrictions(availabilityRequest)
                   .IncludeCancellationPolicies(availabilityRequest)
                   .IncludeRates(availabilityRequest, roomTypes)
                   .IncludePromotionalOffers(availabilityRequest)
                   .IncludeRoomOccupations(availabilityRequest)
                   .IncludeLocation()
                   .Select(relation => relation.Accommodation)
                   .Where(accommodation => ratings.Contains(accommodation.Rating)));
        }
Пример #3
0
        public EdoContracts.Accommodations.Accommodation Create(Accommodation accommodation, string languageCode)
        {
            var id                 = accommodation.Id.ToString();
            var name               = GetName(accommodation, languageCode);
            var amenities          = GetAmenities(accommodation, languageCode);
            var additionalInfo     = GetAdditionalInfo(accommodation, languageCode);
            var category           = Enum.GetName(typeof(PropertyTypes), accommodation.PropertyType) !;
            var contacts           = GetContactInfo(accommodation);
            var locationInfo       = GetLocationInfo(accommodation, languageCode);
            var imageInfo          = GetImageInfo(accommodation, languageCode);
            var rating             = AccommodationRatingConverter.Convert(accommodation.Rating);
            var scheduleInfo       = GetScheduleInfo(accommodation);
            var textualDescription = GetTextualDescription(accommodation, languageCode);
            var propertyType       = GetPropertyType(accommodation);

            return(new EdoContracts.Accommodations.Accommodation(id, name, amenities, additionalInfo, category, contacts, locationInfo, imageInfo, rating, scheduleInfo, textualDescription, propertyType));
        }