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