public static string ToFeatureDescription(this List<Feature> features) { var featureDescription = new StringBuilder(); var garden = features.GardenOrDefault(); if (garden.IsNotNull() && garden.ToGardenDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {garden.ToGardenDescription()}"); var parking = features.ParkingOrDefault(); if (parking.IsNotNull() && parking.ToParkingDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {parking.ToParkingDescription()}"); var whitegoods = features.WhiteGoodsOrDefault(); if (whitegoods.IsNotNull() && whitegoods.ToWhiteGoodsDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {whitegoods.ToWhiteGoodsDescription()}"); var furnishing = features.FurnishingOrDefault(); if (furnishing.IsNotNull() && furnishing.ToFurnishingDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {furnishing.ToFurnishingDescription()}"); var pets = features.PetsOrDefault(); if (pets.IsNotNull() && pets.ToPetsDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {pets.ToPetsDescription()}"); var decoration = features.DecorativeConditionOrDefault(); if (decoration.IsNotNull() && decoration.ToDecorativeDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {decoration.ToDecorativeDescription()}"); var glazing = features.GlazingOrDefault(); if (glazing.IsNotNull() && glazing.ToGlazingDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {glazing.ToGlazingDescription()}"); var heating = features.HeatingOrDefault(); if (heating.IsNotNull() && heating.ToHeatingDescription().IsNotNullOrEmpty()) featureDescription.AppendLine($"- {heating.ToHeatingDescription()}"); if (featureDescription.Length > 0) { featureDescription.PrependLine("The property benefits from the following features:"); } return featureDescription.ToString(); }
public static string ToAmenityDescription(this List<Amenity> amenities) { var amenityDescription = new StringBuilder(); var shopping = amenities.ShoppingOrDefault(); if (shopping.IsNotNull() && shopping.ToShoppingDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {shopping.ToShoppingDescription()}"); var restauarants = amenities.RestaurantsOrDefault(); if (restauarants.IsNotNull() && restauarants.ToRestaurantsDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {restauarants.ToRestaurantsDescription()}"); var bars = amenities.BarsOrDefault(); if (bars.IsNotNull() && bars.ToBarsDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {bars.ToBarsDescription()}"); var cafes = amenities.CafesOrDefault(); if (cafes.IsNotNull() && cafes.ToCafesDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {cafes.ToCafesDescription()}"); var trains = amenities.TrainStationOrDefault(); if (trains.IsNotNull() && trains.ToTrainDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {trains.ToTrainDescription()}"); var buses = amenities.BusStopOrDefault(); if (buses.IsNotNull() && buses.ToBusDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {buses.ToBusDescription()}"); var schools = amenities.SchoolsOrDefault(); if (schools.IsNotNull() && schools.ToSchoolDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {schools.ToSchoolDescription()}"); var parks = amenities.ParksOrDefault(); if (parks.IsNotNull() && parks.ToParkDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {parks.ToParkDescription()}"); var publicTransport = amenities.PublicTransportOrDefault(); if (publicTransport.IsNotNull() && publicTransport.ToPublicTransportDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {publicTransport.ToPublicTransportDescription()}"); var beaches = amenities.BeachesOrDefault(); if (beaches.IsNotNull() && beaches.ToBeachesDescription().IsNotNullOrEmpty()) amenityDescription.AppendLine($"- {beaches.ToBeachesDescription()}"); if (amenityDescription.Length > 0) { amenityDescription.PrependLine("The property is located near to the following amenities:"); } return amenityDescription.ToString(); }