public ActionResult Edit(PartySupporter obj) { if (ModelState.IsValid) { dataManager.PartySupporters.Save(obj); return(RedirectToAction("Show", new { Id = obj.Id })); } return(View(obj)); }
public void Save(PartySupporter obj) { if (obj.Id == 0) { context.Entry(obj).State = System.Data.Entity.EntityState.Added; } else { context.Entry(obj).State = System.Data.Entity.EntityState.Modified; } context.SaveChanges(); }