public ActionResult AddClass(opr.Models.ClassesTable model) { oprEntities db = new oprEntities(); db.ClassesTables.Add(model); db.SaveChanges(); return(View()); }
public ActionResult EditClass(opr.Models.ClassesTable model) { oprEntities cls = new oprEntities(); model.IsDeleted = true; model.IsActive = true; cls.Entry(model).State = System.Data.Entity.EntityState.Modified; try { cls.SaveChanges(); return(RedirectToAction("Index")); } catch { } ModelState.AddModelError("", "Unable to save changes"); return(View(model)); }