public ActionResult BMEmbedBuildingSlider(Guid guid) { var bldg = ((BuildingRepository)_buildingRepo).GetByGuid(guid); if (bldg != null) { var buildingModel = new SliderViewModel(); buildingModel.Id = bldg.Id; buildingModel.AccountId = bldg.AccountId; buildingModel.Name = bldg.Name; buildingModel.Description = bldg.Description; buildingModel.CreatedOn = bldg.CreatedOn; buildingModel.CreatedBy = bldg.CreatedBy; buildingModel.ModifiedBy = bldg.ModifiedBy; buildingModel.ModifiedOn = bldg.ModifiedOn; buildingModel.AccountName = _accountRepo.GetById(bldg.AccountId).Name; var apartmentStatusRepo = new ApartmentStatusRepository(); buildingModel.ApartmentStatuses = apartmentStatusRepo.GetAll() as List <ApartmentStatus>; buildingModel.Guid = bldg.Guid; var asset = new AssetManager(); var assets = asset.GetAssets(bldg.Id); var mediaItems = new Dictionary <int, string>(); foreach (var media in assets) { var umbracoMedia = Umbraco.Media(media.MediaId); mediaItems.Add(media.MediaId, umbracoMedia.Url); } buildingModel.MediaItems = mediaItems; buildingModel.Apartments = _apartmentRepo.GetAllByBuildingId(bldg.Id); return(View("BMEmbedBuildingSlider", buildingModel)); } return(View()); }
public ActionResult GetApartmentStatuses() { var apartmentStatusRepo = new ApartmentStatusRepository(); return(Json(new { apartmentStatuses = apartmentStatusRepo.GetAll() }, JsonRequestBehavior.AllowGet)); }
public ActionResult BMBuildingPage(RenderModel model) { if (model == null || model.Content == null) { return(CurrentUmbracoPage()); } if (model.Content.IsPropertyValid(Constants.BUILDING_PROPERTY_ALIAS)) { int bldgId = -1; int.TryParse(model.Content.GetValidPropertyValue(Constants.BUILDING_PROPERTY_ALIAS).ToString(), out bldgId); if (bldgId > -1) { var bldg = _buildingRepo.GetById(bldgId); var assetManager = new AssetManager(); if (bldg != null) { var buildingModel = new BuildingViewModel(CurrentPage); buildingModel.Id = bldg.Id; buildingModel.AccountId = bldg.AccountId; buildingModel.Name = bldg.Name; buildingModel.Description = bldg.Description; buildingModel.CreatedOn = bldg.CreatedOn; buildingModel.CreatedBy = bldg.CreatedBy; buildingModel.ModifiedBy = bldg.ModifiedBy; buildingModel.ModifiedOn = bldg.ModifiedOn; buildingModel.AccountName = _accountRepo.GetById(bldg.AccountId).Name; var apartmentStatusRepo = new ApartmentStatusRepository(); buildingModel.ApartmentStatuses = apartmentStatusRepo.GetAll() as List <ApartmentStatus>; buildingModel.Guid = bldg.Guid; var asset = new AssetManager(); var assets = asset.GetAssets(bldg.Id); var mediaIds = new List <int>(); foreach (var media in assets) { mediaIds.Add(media.MediaId); } buildingModel.MediaItems = mediaIds; buildingModel.Apartments = _apartmentRepo.GetAllByBuildingId(bldg.Id); // var pdfStatus = new ApartmentAssetPdfViewModel(); foreach (var apartment in buildingModel.Apartments) { var apartmenPdf = assetManager.GetByApartmentId(apartment.Id); var pdfStatus = new ApartmentAssetPdfViewModel(); if (apartmenPdf != null) { pdfStatus.HasPdf = true; pdfStatus.ApartmentId = apartment.Id; } else { pdfStatus.HasPdf = false; pdfStatus.ApartmentId = apartment.Id; } buildingModel.PdfStatus.Add(pdfStatus); } return(CurrentTemplate(buildingModel)); } } return(CurrentUmbracoPage()); } return(CurrentUmbracoPage()); }