public ActionResult AddSubCategory(tblsubcategory scat) { if (Session["AdminID"] == null) { return(RedirectToAction("doLogIn")); } else { res.tblsubcategories.Add(scat); res.SaveChanges(); return(RedirectToAction("SubCategoryByCat", new { id = scat.CategoryID })); } }
public ActionResult AddSubCategory(int id) { if (Session["AdminID"] == null) { return(RedirectToAction("doLogIn")); } else { tblsubcategory _subcat = new tblsubcategory(); _subcat.CategoryID = id; ViewData.Model = _subcat; return(View()); } }