// 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 }))); } }