public ActionResult Create(EstabelecimentoViewModel estabelecimentoVM)
        {
            LoadModel(estabelecimentoVM);

            if (ModelState.IsValid)
            {
                var model   = Mapper.Map <EstabelecimentoViewModel, EstabelecimentoModel>(estabelecimentoVM);
                var retorno = _estabelecimentoService.Create(model);

                if (retorno != ERetornoEstabelecimento.SucessoCadastro)
                {
                    Alert(RetornoHelper.RetornoEstabelecimento(retorno), NotificationType.error);

                    return(View("Create", estabelecimentoVM));
                }

                Alert(RetornoHelper.RetornoEstabelecimento(retorno), NotificationType.success);
                return(RedirectToAction("Index"));
            }

            return(View("Create", estabelecimentoVM));
        }
Пример #2
0
 public async Task <ResultDto <EstabelecimentoDto> > Post([FromBody] EstabelecimentoDto estabelecimentoDto)
 {
     return(await _estabelecimentoService.Create(estabelecimentoDto));
 }