public static HouseVm GetHouseUnit() { HouseVm houseVm = new HouseVm() { PriceRange = new MeasureBoundaryVm <decimal, MoneyType>(), LivingSpace = new MeasureBoundaryVm <int, LivingSpaceMeasure>(), Deposit = new MeasureBoundaryVm <decimal, MoneyType>(), ApplicationFee = new MeasureBoundaryVm <decimal, MoneyType>(), PetDeposit = new MeasureBoundaryVm <decimal, MoneyType>(), AvailableBedroomsFromQuantity = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBedrooms().ToSelectListItemList(), AvailableBedroomsToQuantity = houseVm.AvailableBedroomsFromQuantity, AvailableBathroomsFromQuantity = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBathrooms().ToSelectListItemList(), AvailableBathroomsToQuantity = houseVm.AvailableBathroomsFromQuantity, CustomAmenities = new List <AmenityVm>() { new AmenityVm() }, DefaultAmenities = AmenityBc.Instance.GetDefaultAmenities(CommunityUnitType.House).ConvertAll <CheckBoxVm>((Amenity m) => new CheckBoxVm() { Value = m.ClassId.ToString(), Text = m.Name }), Images = new ImageListVm(DisplayHelpers.GetDisplayNameForCommunityUnitImages(CommunityUnitType.House)), Address = AdminViewModelsProvider.GetAddressVm() }; return(houseVm); }
internal static HouseVm MapToHouseVm(this House house) { HouseVm houseVm = new HouseVm(); List <KeyValuePair <int, string> > bedrooms = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBedrooms(); List <KeyValuePair <int, string> > bathrooms = MSLivingChoices.Bcs.Components.ItemTypeBc.Instance.GetBathrooms(); List <Amenity> defaultAmenities = AmenityBc.Instance.GetDefaultAmenities(CommunityUnitType.House); houseVm.Id = house.Id; houseVm.Name = house.Name; houseVm.BedroomFromId = house.BedroomFromId; houseVm.BedroomToId = house.BedroomToId; houseVm.AvailableBedroomsFromQuantity = bedrooms.ToSelectListItemList(house.BedroomFromId); houseVm.AvailableBedroomsToQuantity = bedrooms.ToSelectListItemList(house.BedroomToId); houseVm.BathroomFromId = house.BathroomFromId; houseVm.BathroomToId = house.BathroomToId; houseVm.AvailableBathroomsFromQuantity = bathrooms.ToSelectListItemList(house.BathroomFromId); houseVm.AvailableBathroomsToQuantity = bathrooms.ToSelectListItemList(house.BathroomToId); houseVm.PriceRange = house.PriceRange.MapToMeasureBoundaryVm <decimal, MoneyType>(); houseVm.Deposit = house.Deposit.MapToMeasureBoundaryVm <decimal, MoneyType>(); houseVm.PetDeposit = house.PetDeposit.MapToMeasureBoundaryVm <decimal, MoneyType>(); houseVm.ApplicationFee = house.ApplicationFee.MapToMeasureBoundaryVm <decimal, MoneyType>(); houseVm.LivingSpace = house.LivingSpace.MapToMeasureBoundaryVm <int, LivingSpaceMeasure>(); houseVm.DefaultAmenities = house.Amenities.MapToCheckBoxVmList(defaultAmenities); houseVm.CustomAmenities = house.Amenities.MapToAmenityVmList(defaultAmenities); houseVm.Images = house.Images.MapToImageListVm(DisplayNames.HouseImages); houseVm.SaleType = house.SaleType; houseVm.Description = house.Description; houseVm.YearBuilt = house.YearBuilt; houseVm.Address = house.Address.MapToAddressVm(); return(houseVm); }