public ActionResult Index() { var currentPage = CurrentPage.DocumentTypeAlias; var umbContent = UmbracoAssignedContentHelper.PageContentByAlias(currentPage); var xLargeImage = umbContent.GetCropUrl(propertyAlias: "responsiveImageExample", cropAlias: "X-Large-Desktop"); var desktop = umbContent.GetCropUrl(propertyAlias: "responsiveImageExample", cropAlias: "Desktop"); var landScape = umbContent.GetCropUrl(propertyAlias: "responsiveImageExample", cropAlias: "LandScape"); var tablet = umbContent.GetCropUrl(propertyAlias: "responsiveImageExample", cropAlias: "Tablet"); var mobile = umbContent.GetCropUrl(propertyAlias: "responsiveImageExample", cropAlias: "Mobile"); var crops = umbContent.GetPropertyValue <ImageCropDataSet>("responsiveImageExample"); int cropWidthXLarge = crops.Crops.First(x => x.Alias.InvariantEquals("X-Large-Desktop")).Width; int cropWidthDesktop = crops.Crops.First(x => x.Alias.InvariantEquals("DeskTop")).Width; int cropWidthLandScape = crops.Crops.First(x => x.Alias.InvariantEquals("LandScape")).Width; int cropWidthTablet = crops.Crops.First(x => x.Alias.InvariantEquals("Tablet")).Width; int cropWidthMobile = crops.Crops.First(x => x.Alias.InvariantEquals("Mobile")).Width; var model = new ResponsiveImageViewModel { XLargeImage = xLargeImage, Desktop = desktop, LandScape = landScape, Tablet = tablet, Mobile = mobile, CropWidthXLarge = $"{cropWidthXLarge}w", CropWidthDesktop = $"{cropWidthDesktop}w", CropWidthLandscape = $"{cropWidthLandScape}w", CropWidthTablet = $"{cropWidthTablet}w", CropWidthMobile = $"{cropWidthMobile}w" }; return(PartialView("~/Views/Partials/pvImageCropper.cshtml", model)); }
public ActionResult Index() { var currentPage = CurrentPage.DocumentTypeAlias; var umbContent = UmbracoAssignedContentHelper.PageContentByAlias(currentPage); string textColour = umbContent.GetPropertyValue <ColorPickerValueConverter.PickedColor>("textColour").Label; string backgroundColour = umbContent.GetPropertyValue <ColorPickerValueConverter.PickedColor>("sectionBackgroundColour").Label; int fontSize = umbContent.GetPropertyValue <int>("fontSize"); string displayTextColour = "black"; string displayBackgroundColour = "white"; switch (textColour) { case nameof(EnumColourPicker.ColourPickerEnum.Red): displayTextColour = "textRed"; break; case nameof(EnumColourPicker.ColourPickerEnum.Black): displayTextColour = "textBlack"; break; } switch (Regex.Replace(backgroundColour, " ", "")) { case nameof(EnumColourPicker.ColourPickerEnum.Tomato): displayBackgroundColour = "backgroundColourTomato"; break; case nameof(EnumColourPicker.ColourPickerEnum.DarkOrange): displayBackgroundColour = "backgroundColourDarkOrange"; break; } string displayfontSize = DisplayFontSize.SectionFontSize(fontSize); var model = new ColourPickerViewModel { TextColour = displayTextColour, BackgroundColour = displayBackgroundColour, FontSize = displayfontSize }; return(PartialView("~/Views/Partials/pvEnumColourExample.cshtml", model)); }
public ActionResult Index() { var currentPage = CurrentPage.DocumentTypeAlias; var umbContent = UmbracoAssignedContentHelper.PageContentByAlias(currentPage); string displayImage = string.Empty; string doesImageMediaHaveValue = umbContent.GetPropertyValue <string>("testMediaImage", "NA"); if (int.TryParse(doesImageMediaHaveValue, out _)) { displayImage = umbContent.GetPropertyValue <IPublishedContent>("testMediaImage").Url; } var model = new CheckForNullViewModel { TestString = umbContent.GetPropertyValue <string>("testString", "I have no value"), TestRte = umbContent.GetPropertyValue("testRte", new HtmlString("RTE has no value")), TestImage = displayImage }; return(PartialView("~/Views/Partials/pvCheckForNulls.cshtml", model)); }