public static UmbracoImage Map(string imageId, UmbracoHelper helper, string cropName = CropHelper.ProductThumbnail)
 {
     if (!string.IsNullOrWhiteSpace(imageId))
     {
         var image = helper.TypedMedia(imageId);
         if (image != null)
         {
             UmbracoImage umbImg = new UmbracoImage();
             umbImg.ImageUrl = image.Url;
             umbImg.AltText = image.Name;
             umbImg.Crop = image.GetCrop(cropName);
             return umbImg;
         }
     }
     return null;
 }
        //
        // GET: /Master/
        public ActionResult Index(BaseModel model)
        {
            var frontpage = CurrentPage.AncestorOrSelf(1);
            var imagesIdCsv = frontpage.GetPropertyValue<string>("bannerImages");
            var imageIds = imagesIdCsv.Split(',');

            List<UmbracoImage> imgList = new List<UmbracoImage>();
            foreach (var imageId in imageIds)
            {
                UmbracoImage img = new UmbracoImage();

                img = UmbracoImageMapper.Map(imageId, Umbraco, CropHelper.FrontpageBanner);
                imgList.Add(img);
            }
            model.BannerImages = imgList;
            model.TopNavigation = NavigationMapper.Map(CurrentPage, true);
            model.SideNavigation = NavigationMapper.Map(CurrentPage);

            model.MetaTitle = CurrentPage.GetPropertyValue<string>("MetaTitle");
            if (string.IsNullOrWhiteSpace(model.MetaTitle))
            {
                model.MetaTitle = frontpage.GetPropertyValue<string>("MetaTitle");
            }

            model.MetaDescription = CurrentPage.GetPropertyValue<string>("MetaDescription");
            if (string.IsNullOrWhiteSpace(model.MetaDescription))
            {
                model.MetaDescription = frontpage.GetPropertyValue<string>("MetaDescription");
            }

            model.MetaKeywords = CurrentPage.GetPropertyValue<string>("MetaKeywords");
            if (string.IsNullOrWhiteSpace(model.MetaKeywords))
            {
                model.MetaKeywords = frontpage.GetPropertyValue<string>("MetaKeywords");
            }

            return View(model);
        }
        public static IEnumerable<Product> Map(IPublishedContent currentPage, UmbracoHelper helper)
        {
            List<Product> productList = new List<Product>();
            var products = currentPage.Children.Where(x => x.IsDocumentType("Product"));

            if (products != null)
            {
                foreach (var item in products)
                {
                    Product p = new Product();

                    var imagesIdCsv = item.GetPropertyValue<string>("images");

                    if (!string.IsNullOrWhiteSpace(imagesIdCsv))
                    {
                        var imageIds = imagesIdCsv.Split(',');
                        List<UmbracoImage> imgList = new List<UmbracoImage>();
                        foreach (var imageId in imageIds)
                        {
                            UmbracoImage img = new UmbracoImage();

                            img = UmbracoImageMapper.Map(imageId, helper);
                            imgList.Add(img);
                        }
                        p.Images = imgList;
                    }
                    p.Description = item.GetPropertyValue<IHtmlString>("description");
                    productList.Add(p);
                }
                if (productList.Any())
                {
                    return productList;
                }
            }
            return null;
        }