Пример #1
0
        public ActionResult Create(ClienteViewModel viewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(viewModel));
                }

                _clienteApp.Add(viewModel);

                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(View(viewModel));
            }
        }
Пример #2
0
        public async Task <ActionResult> Create(ClienteViewModel viewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(viewModel));
                }

                var resultado = _clienteApp.Add(viewModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }