public IActionResult Index()
 {
     try
     {
         var          list = _prodService.GetProducts();
         CatalogModel mdel = new CatalogModel()
         {
             Products = list, Categories = _catService.GetCategories()
         };
         return(View(mdel));
     }
     catch
     {
         TempData["Warning"] = "Failed to load products. Please try again later";
         return(RedirectToAction("Error", "Home"));
     }
 }
コード例 #2
0
        public IActionResult Index()

        {
            try
            {
                var          list = _cartservice.GetCarts();
                CatalogModel mdel = new CatalogModel()
                {
                    Carts = list, Products = _prodService.GetProducts(), Categories = _catService.GetCategories()
                };
                string user = User.Identity.Name;
                return(View(mdel));
            }
            catch
            {
                TempData["Warning"] = "Failed to load Index, Please try again later";
                return(RedirectToAction("Error", "Home"));
            }
        }