public ActionResult Create(Routine routine) { try { // TODO: Add insert logic here if (ModelState.IsValid) { db.Routines.Add(routine); db.SaveChanges(); return RedirectToAction("Index"); } return View(routine); } catch { return View(); } }
public ActionResult Edit(int id, Routine routine) { try { // TODO: Add update logic here if (ModelState.IsValid) { db.Entry(routine).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(routine); } catch { return View(); } }