Beispiel #1
0
        public ActionResult Editar(Comanda comanda)
        {
            try
            {
                var comandaRepository = new ComandasRepository();

                if (comandaRepository.Salvar(comanda))
                {
                    ViewData["mensagem"] = "<h1>Usuario cadastrado com sucesso!</h1>";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewData["mensagem"] = "<h1>DEU RUIM</h1>";
                    return(View(comanda));
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Beispiel #2
0
        public ActionResult Cadastro(Comanda comanda)
        {
            try
            {
                var comandaRepository = new ComandasRepository();
                var validate          = comandaRepository.ValidarComandaExistente(comanda);

                if (!validate && comandaRepository.Salvar(comanda))
                {
                    ViewData["mensagem"] = "<h1>Usuario cadastrado com sucesso!</h1>";
                    return(RedirectToAction("Index"));
                }

                else
                {
                    ViewData["mensagem"] = "<h1>DEU RUIM</h1>";
                    return(View("Index"));
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }