Ejemplo n.º 1
0
        public ActionResult Create(BancoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var banco = Mapper.Map <BancoViewModel, Banco>(model);
                _bancoApplicationService.Add(banco);

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(BancoViewModel banco)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(View(banco));
            }

            var commandResult = await _bancoApplicationService.Add(banco);

            if (commandResult.Success)
            {
                NotifyCommandResultSuccess();
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                NotifyCommandResultErrors(commandResult.Errors);
            }

            return(View(banco));
        }