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"); } }
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"); } }