public ActionResult ChangeProductImage(string productId, string color, string sizeCategory) { //decode size category sizeCategory = sizeCategory.Replace("_amp_", "'"); var imgsModel = DetailManager.GetProductImageModelByColor(productId, color); var videoModel = DetailManager.GetProductVideoModel(productId); var sizesModel = DetailManager.GetSizesByColorAndSizeCategory(productId, color, sizeCategory); var detailModel = new DetailModel { ProductImages = imgsModel, ProductVideos = videoModel }; return(RenderMultipleViews(new List <RenderViewInfo>() { new RenderViewInfo() { ViewName = "zoomedView", ViewPath = "~/Views/Partials/Detail/_ZoomedImagePartial.cshtml", Model = imgsModel }, new RenderViewInfo() { ViewName = "imagesView", ViewPath = "~/Views/Partials/Detail/_ImagesPartial.cshtml", Model = detailModel }, new RenderViewInfo() { ViewName = "sizesView", ViewPath = "~/Views/Partials/Detail/_SizesPartial.cshtml", Model = sizesModel }, new RenderViewInfo() { ViewName = "shareView", ViewPath = "~/Views/Partials/Detail/_SocialSharePartial.cshtml", Model = imgsModel } })); }
public static List <FavoriteProduct> GetFavoriteProducts(List <FavoriteProduct> codesAndColors) { using (var client = new LandauPortalWebAPI()) { var result = new List <FavoriteProduct>(); var favProducts = client.Products.GetAllByProductCodes(codesAndColors.Select(f => f.ProductCode).Distinct().ToArray()).Results; foreach (var aProd in codesAndColors) { var inputFav = favProducts.Where(c => c.ProductCode == aProd.ProductCode).FirstOrDefault(); if (inputFav != null) { var fav = new FavoriteProduct(); fav.ProductCode = aProd.ProductCode; fav.ProductName = inputFav.ProductName; fav.ColorCode = aProd.ColorCode; fav.ColorHex = aProd.ColorHex; fav.ColorName = aProd.ColorName; fav.ColorUrl = aProd.ColorUrl; fav.SizeCategory = aProd.SizeCategory; fav.SizeCode = aProd.SizeCode; var image = DetailManager.GetProductImageModelByColor(aProd.ProductCode, aProd.ColorCode); fav.ProductDetailImageUri = image != null && image.Count > 0 ? image.First().DetailImageUri : string.Empty; if (string.IsNullOrEmpty(fav.ProductDetailImageUri)) { fav.ProductDetailImageUri = inputFav.Image != null ? inputFav.Image.DetailImageUri : string.Empty; } result.Add(fav); } } return(result); } }
public ActionResult Canonical(String product) { try { var bc = new BreadcrumbModel(); var model = GetDetailModelFromProduct(product, bc, false); if (!ProductUrlIsCorrect(model.ProductDetail)) { throw Utility.Exception404(); } this.BuildBreadcrumb(bc, model.ProductDetail.DefaultCategory, model.ProductDetail.DefaultCollection, Constants.GenderFor(model.ProductDetail.DefaultGender), model.ProductDetail.DefaultGender.ToLower()); //navigation should not be available since it's not entering from a catalog search model.IsCanonicalUrl = true; if (!String.IsNullOrEmpty(Request.QueryString["color"])) { //color selected in previous page model.SelectedColor = model.ColorsAndSizes.GetProductColorModel(Request.QueryString["color"]); if (model.SelectedColor != null) { model.ProductImages = DetailManager.GetProductImageModelByColor(product, model.SelectedColor.ColorCode); } } return(BuildDetailView(model)); } catch { throw Utility.Exception404(); } }