Пример #1
0
 public ActionResult Alta(Seccion seccion)
 {
     try
     {
         if (ModelState.IsValid)
         {
             context.seccion.Add(seccion);
             context.SaveChanges();
             return RedirectToAction("Index");
         }
         else
             return View();
     }
     catch(Exception ex)
     {
         ModelState.AddModelError("Fail", ex.Message);
         return View();
     }
 }
Пример #2
0
 public ActionResult Editar(Seccion seccion)
 {
     try
     {
         if (ModelState.IsValid)
         {
             context.Entry(seccion).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return RedirectToAction("Index");
         }
         else
             return View();
     }
     catch (Exception ex)
     {
         return View();
     }
 }