public ActionResult Salvar(Registro registro) { if (!ModelState.IsValid) { return(View("Cadastro", registro)); } string acao = registro.IdRegistro == 0 ? "Salvar registro: " : "Editar registro: "; try { _dao.Salvar(registro); LogINFO(this.ToString(), acao + LAB5Utils.ReflectionUtils.GetObjectDescription(registro)); return(RedirectToAction("Index")); } catch (Exception ex) { Alert(ex.Message); LogWARN(this.ToString(), acao + LAB5Utils.ReflectionUtils.GetObjectDescription(registro) + ex.Message); return(View("Cadastro", registro)); } }