public ActionResult Editar(Visita model) { if (ModelState.IsValid) { try { //var Servico = new VisitaServico(); if (model != null) { _servico.Salvar(model, UsuarioId); } //model.ListaConsulta = Filtrar(model.Filtro); return(RedirectToAction("Index")); } catch (Exception ex) { //ModelState.AddModelError("", ex.Message); //return RedirectToAction("index"); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message)); } } else { return(View(model)); } }
public ActionResult Alterar(Visita model) { try { if (model != null) { _servico.Salvar(model, UsuarioId); } return(RedirectToAction("Index")); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message)); //ModelState.AddModelError("", ex.Message); } //return RedirectToAction("index"); }