public void UpdateEntry(clsTimeEntry updatedEntry) { using (TimeCardContext context = new TimeCardContext()) { DbEntityEntry <clsTimeEntry> entry = context.Entry(updatedEntry); if (entry == null) { context.TimeCardEntries.Attach(updatedEntry); entry = context.Entry(updatedEntry); } entry.State = EntityState.Modified; context.SaveChanges(); } }
public ActionResult Edit(Employee updatedEmployee) { if (ModelState.IsValid) { var db = new TimeCardContext(); db.Entry(updatedEmployee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(updatedEmployee)); }