public IActionResult Put(Guid id, [FromBody] SistemaViewModel obj) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != obj.Id) { return(BadRequest()); } try { _sistemaAppService.Alterar(obj); } catch (DbUpdateConcurrencyException) { if (!ObjExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _sistemaAppService.Alterar(Sistema); return(RedirectToPage("Listar")); }
public JsonResult AlterarSistemaAlvo(SistemaAlvoViewModel sistemaAlvoViewModel) { try { _sistemaAppService.Alterar(sistemaAlvoViewModel, DadosUsuario().CodUsuario); return(RetornoSucesso("Sistema alterado com sucesso!")); } catch (BusinessException ex) { log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Error(ex); return(RetornoMensagemErro(ex.Message)); } catch (Exception ex) { log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Error(ex); return(Json(new { Status = HttpStatusCode.InternalServerError, Codigo = 0, Mensagem = ex.Message }, JsonRequestBehavior.AllowGet)); } }