public ActionResult Editar(int? id, string error) { try { MarcaProdutoDTO MarcaProdutoDTO; if (!id.HasValue || id == 0) { MarcaProdutoDTO = new MarcaProdutoDTO(); } else { MarcaProdutoDTO = _marcaProdutoAppService.FindMarcaProduto(id.Value); } return View(MarcaProdutoDTO); } catch (Exception ex) { return View("Error", ex); } }
public ActionResult POSTEditar(MarcaProdutoDTO marcaProdutoDTO) { try { if (marcaProdutoDTO.Id == 0) { marcaProdutoDTO = _marcaProdutoAppService.AddMarcaProduto(marcaProdutoDTO); } else { _marcaProdutoAppService.UpdateMarcaProduto(marcaProdutoDTO); } return JavaScript( "MensagemSucesso(' + mensagemSucesso + ');" + "CarregarPaginaAjax('" + Url.Action("Index", "MarcaProduto") + "');"); } catch (Exception ex) { TratamentoErro.Tratamento(this, ex); return View("Editar", marcaProdutoDTO); } }