public ActionResult AddCategory(CategoryOfServices cat) { using (var db = new ApplicationDbContext()) { db.CategoryOfServices.Add(cat); db.SaveChanges(); } return(RedirectToAction("AllCategory")); }
public ActionResult EditCategory(CategoryOfServices cat) { using (var db = new ApplicationDbContext()) { var ct = db.CategoryOfServices.Find(cat.Id); ct.Name = cat.Name; db.SaveChanges(); } return(RedirectToAction("AllCategory")); }