public ActionResult UpdateProduct(string id, string filter)
        {
            var product = pr.SelectById(id);

            if (product != null)
            {
                ViewBag.MainCat = new SelectList(mcr.SelectAll(), "Id", "Name", product.SubCategory.MainCategoryId);
                ViewBag.SubCat  = new SelectList(mcr.SelectById(product.SubCategory.MainCategoryId).SubCategories, "Id", "Name", product.SubCategoryId);
                ViewBag.Filter  = filter;
                var addProductModel = new AddOrUpdateProductModel();
                addProductModel.Product = product;
                return(View(addProductModel));
            }
            return(Redirect("/Admin/Product/ProductList?filter=" + filter));
        }
 public ActionResult MainCategoryAddOrUpdate(string CategoryName, string id)
 {
     if (id != null && !string.IsNullOrWhiteSpace(CategoryName))
     {
         var mainCat = mcr.SelectById(id);
         mainCat.Name = CategoryName;
         mcr.AddOrUpdate(mainCat);
     }
     else if (!string.IsNullOrWhiteSpace(CategoryName))
     {
         var mainCat = new MainCategory();
         mainCat.Name = CategoryName;
         mcr.AddOrUpdate(mainCat);
     }
     return(RedirectToAction("Categories"));
 }