// GET: Home public ActionResult Index() { HomeModel model = (HomeModel)mainModel; var frontPageBanners = frontPageBannerRepository.GetAll().Where(x => x.IsCarousel == true && x.IsShown == true).ToList(); List <FrontPageBannerDTO> frontPageBanner = Mapper.Map <List <FrontPageBannerDTO> >(frontPageBanners); model.FrontPageBanner = frontPageBanner; var latestProducts = productRepository.GetAll().Reverse().Take(10).ToList(); List <ProductDTO> latestProductsDTOs = Mapper.Map <List <ProductDTO> >(latestProducts); model.LatestProducts = latestProductsDTOs; var featuredProducts = featuredProductsRepository.GetAll().Where(x => x.IsShown == true).Take(10); List <FeaturedProductDTO> featuredProductDTOs = Mapper.Map <List <FeaturedProductDTO> >(featuredProducts); model.FeaturedProduct = featuredProductDTOs; var bestSellerProducts = orderRepository.GetBestSellers(); List <ProductDetailDTO> bestSellerProductDTOs = Mapper.Map <List <ProductDetailDTO> >(bestSellerProducts); model.BestSellers = bestSellerProductDTOs; return(View(model)); }
// GET: FeaturedProduct public ActionResult Index() { var featuredProducts = featuredProductsRepository.GetAll().ToList(); var featuredProductsDto = Mapper.Map <List <FeaturedProduct>, List <FeaturedProductDTO> >(featuredProducts); return(Json(featuredProductsDto, JsonRequestBehavior.AllowGet)); }