public IActionResult SaveOrEdit(int?id) { VeiculoModel model = new VeiculoModel(); try { if (id.HasValue && id != 0) { model = _veiculoApplication.ObterPorId(Convert.ToInt32(id)); } } catch (Exception ex) { string message = string.Format("Atenção: {0}", ex.Message); ModelState.AddModelError(string.Empty, message); } return(View(model)); }