public ActionResult Editar([Bind(Include = "TipoSaudeId,Nome,Descricao")] TipoSaudeViewModel tipoSaudeVM) { if (ModelState.IsValid) { var tipoSaude = Mapper.Map <TipoSaudeViewModel, TipoSaude>(tipoSaudeVM); db.Entry(tipoSaude).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tipoSaudeVM)); }
public ActionResult Adicionar([Bind(Include = "TipoSaudeId,Nome,Descricao")] TipoSaudeViewModel tipoSaudeVM) { if (ModelState.IsValid) { var tipoSaude = Mapper.Map <TipoSaudeViewModel, TipoSaude>(tipoSaudeVM); db.TipoSaude.Add(tipoSaude); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tipoSaudeVM)); }