コード例 #1
0
 public ActionResult Delete(int id, PlanoSaude planosaude)
 {
     ViewBag.Title = tituloCadastro;
     try
     {
         using (var db = new ClinicaEntities())
         {
             db.Entry(planosaude).State = System.Data.EntityState.Deleted;
             db.SaveChanges();
         }
         return RedirectToAction("Index");
     }
     catch (Exception e)
     {
         ViewBag.Error = e;
         return View("Error");
     }
 }
コード例 #2
0
        public ActionResult Create(PlanoSaude planosaude)
        {
            ViewBag.Title = tituloCadastro;
            try
            {
                using (var db = new ClinicaEntities())
                {
                    db.PlanoSaude.Add(planosaude);
                    db.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch (Exception e)
            {
                ViewBag.Error = e;
                return View("Error");
            }
        }