public ActionResult Edit(Role1 model) { try { // TODO: Add update logic here var db = DB.Entities; var obj = db.Role1.First(m => m.ID == model.ID); obj.Name = model.Name; db.ObjectStateManager.ChangeObjectState(obj, System.Data.EntityState.Modified); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Role1 model) { try { // TODO: Add insert logic here var db = DB.Entities; var role = new Role1() { Name = model.Name }; db.Role1.AddObject(role); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }