コード例 #1
0
        public ActionResult CategoryResult(Guid id)
        {
            var objects    = base.ViewBag.Data as Dictionary <string, dynamic> ?? new Dictionary <string, dynamic>();
            var categories = ApiUtil.GetCategoryList().Result;

            objects.Add("SearchCategories", categories ?? new List <Category>());
            ViewBag.Data = objects;
            var productList = ApiUtil.GetProductByCategory(id).Result;

            if (productList == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(new CategoryResultVM()
            {
                ProductList = productList, Category = categories.FirstOrDefault(x => x.Oid == id)
            }));
        }