Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
 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();
     }
 }