public ActionResult Salvar(PedidoMaterialViewModel model) { //if (ModelState.IsValid) //{ // var PedidoMaterialViewModel = _PedidoMaterialAppService.RegistrarInclusaoPedidoMaterial(model); // if (!PedidoMaterialViewModel.ValidationResult.IsValid) // { // foreach (var erro in PedidoMaterialViewModel.ValidationResult.Erros) // ModelState.AddModelError(string.Empty, erro.Message); // return Json(new { erro = 901, mensagem = RetornaMsgErroFormulario.RetornaMsgErro(ModelState) }); // } // return Json(new { erro = 0, mensagem = PedidoMaterialViewModel.ValidationResult.Message }); //} //else return(Json(new { erro = 901, mensagem = RetornaMsgErroFormulario.RetornaMsgErro(ModelState) })); }
public ActionResult Salvar(ServicoViewModel model) { if (ModelState.IsValid) { var ServicoViewModel = _fspAppService.RegistrarInclusaoServico(model); if (!ServicoViewModel.ValidationResult.IsValid) { foreach (var erro in ServicoViewModel.ValidationResult.Erros) { ModelState.AddModelError(string.Empty, erro.Message); } return(Json(new { erro = 901, mensagem = RetornaMsgErroFormulario.RetornaMsgErro(ModelState) })); } return(Json(new { erro = 0, mensagem = ServicoViewModel.ValidationResult.Message })); } else { return(Json(new { erro = 901, mensagem = RetornaMsgErroFormulario.RetornaMsgErro(ModelState) })); } }
public ActionResult Alterar(FornecedorViewModel model) { if (ModelState.IsValid) { var FornecedorViewModel = _fSPAppService.RegistrarAlteracaoFornecedor(model); if (!FornecedorViewModel.ValidationResult.IsValid) { foreach (var erro in FornecedorViewModel.ValidationResult.Erros) { ModelState.AddModelError(string.Empty, erro.Message); } return(Json(new { erro = 901, mensagem = RetornaMsgErroFormulario.RetornaMsgErro(ModelState) })); } return(Json(new { erro = 1, mensagem = FornecedorViewModel.ValidationResult.Message })); } else { return(Json(new { erro = 901, mensagem = RetornaMsgErroFormulario.RetornaMsgErro(ModelState) })); } }