コード例 #1
0
        /// <summary>
        /// function search
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult SearchProduct(string SearchText, int?pageIndex)
        {
            try
            {
                if (!string.IsNullOrEmpty(SearchText))
                {
                    int pageSize = 20;
                    var page     = pageIndex ?? 1;

                    var result = ConvertDomainToModel.GetProducts(_productService.ManySearch(SearchText));

                    ViewBag.SearchText = SearchText;
                    return(View(result.ToPagedList(page, pageSize)));
                }
                else
                {
                    ViewBag.Error = "Not Empty";
                    return(RedirectToAction("index"));
                }
            }
            catch { return(RedirectToAction("Erorr", "Home")); }
        }
コード例 #2
0
        public ActionResult Index()
        {
            try
            {
                var model = new HomeViewModel();

                model.BannerMain   = GetBanner(_bannerService.GetBannerByType(BannerType.MainBanner));
                model.BannerMen    = GetBanner(_bannerService.GetBannerByType(BannerType.MenBanner));
                model.BannerWomen  = GetBanner(_bannerService.GetBannerByType(BannerType.WomenBanner));
                model.SquareMen    = GetProAd(_productAdvertisement.GetProductAdvertisementByType(ProductAdvertisementType.MenSquareBanner));
                model.Squarewomen  = GetProAd(_productAdvertisement.GetProductAdvertisementByType(ProductAdvertisementType.WomenSquareBanner));
                model.SquareUnisex = GetProAd(_productAdvertisement.GetProductAdvertisementByType(ProductAdvertisementType.UnisexSquareBanner));

                model.BannerSlider = GetAllSliderBanner();
                var productsHot = _productService.GetProductsByCategotyName("Hot");
                model.productsHot = ConvertDomainToModel.GetProducts(productsHot);
                var productsNew = _productService.GetProductsByCategotyName("New Products");
                model.productcsNew = ConvertDomainToModel.GetProducts(productsNew);
                return(View(model));
            }
            catch { return(RedirectToAction("Erorr", "Home")); }
        }
コード例 #3
0
        /// <summary>
        /// Product Detail
        /// </summary>
        /// <param name="id">Product ID</param>
        /// <returns>View with model info product</returns>
        public ActionResult ProductDetail(Guid id, string volume)
        {
            try
            {
                string vo;
                // get volume
                if (volume == null)
                {
                    vo = _productVariationService.GetVolumeFisrtById(id);
                }
                else
                {
                    vo = volume;
                }

                var model = GetProductVaDetailViewModel(_productVariationService.GetProductVariationByIdAndVolume_version2(id, vo));

                var product = _productService.GetProductById(id);
                ViewBag.ProductRelate = ConvertDomainToModel.GetProducts(_productService.GetProductsByBrandId(product.Brand_Id));
                return(View(model));
            }
            catch { return(RedirectToAction("Erorr", "Home")); }
        }