// GET: Admin/Product public ActionResult AddProduct(Guid?id) { try { var objects = new Dictionary <string, dynamic>(); var brands = ApiUtil.GetBrandList().Result ?? new List <Brand>(); var categories = ApiUtil.GetCategoryListForProduct().Result ?? new List <Category>(); var tagList = ApiUtil.GetTagList().Result ?? new List <Tag>(); objects.Add("Brands", brands); objects.Add("Categories", categories); objects.Add("TagList", tagList); ViewBag.Data = objects; // TODO: ViewData nasıl? if (id == null) { return(View(new Product() { TagList = tagList })); } else { var product = ApiUtil.GetProduct(id.Value).Result; product.TagList = tagList; return(View(product)); } } catch (Exception ex) { return(RedirectToAction("Index", new RouteValueDictionary(new { controller = "ErrorHandler", action = "Index", data = ex.InnerException?.Message ?? ex.Message }))); } }
public ActionResult ListBrand() { try { var brandList = ApiUtil.GetBrandList().Result; return(View(brandList)); } catch (Exception ex) { return(RedirectToAction("Index", new RouteValueDictionary(new { controller = "ErrorHandler", action = "Index", data = ex.InnerException?.Message ?? ex.Message }))); } }
public ActionResult Index() { var objects = base.ViewBag.Data as Dictionary <string, dynamic> ?? new Dictionary <string, dynamic>(); objects.Add("SearchCategories", Categories ?? new List <Category>()); var mainScreenProducts = ApiUtil.GetMainScreenProducts().Result; var bestSellerProducts = ApiUtil.GetBestSellerProducts().Result; var opportunityProducts = ApiUtil.GetOpportunityProducts().Result; var newProducts = ApiUtil.GetNewProducts().Result; var outletProducts = ApiUtil.GetOutletProducts().Result; var brands = ApiUtil.GetBrandList().Result; var categories = ApiUtil.GetCategoryList().Result; objects.Add("BestSellerProducts", bestSellerProducts); objects.Add("MainScreenProducts", mainScreenProducts); objects.Add("OpportunityProducts", opportunityProducts); objects.Add("NewProducts", newProducts); objects.Add("OutletProducts", outletProducts); objects.Add("Categories", categories); objects.Add("BrandList", brands); ViewBag.Data = objects; return(View()); }