Exemple #1
0
        public IActionResult Salvar(MotivoNaoVenda motivo)
        {
            MotivoNaoVendaBLL BLL = new MotivoNaoVendaBLL();
            string            mensagemErro;


            if (motivo.Codigo == null)
            {
                if (BLL.insertMotivoNaoVenda(motivo, out mensagemErro))
                {
                    TempData["mensagemSucesso"] = "Motivo cadastrado com sucesso!";
                }
                else
                {
                    TempData["mensagemErro"] = mensagemErro;
                }
            }
            else
            {
                if (BLL.updateMotivoNaoVenda(motivo, out mensagemErro))
                {
                    TempData["mensagemSucesso"] = "Motivo atualizado com sucesso!";
                }
                else
                {
                    TempData["mensagemErro"] = mensagemErro;
                }
            }

            return(RedirectToAction("List"));
        }
Exemple #2
0
        public IActionResult Edit(int?codigoMotivo)
        {
            MotivoNaoVendaBLL BLL = new MotivoNaoVendaBLL();
            string            mensagemErro;

            if (codigoMotivo != null && codigoMotivo != 0)
            {
                MotivoNaoVenda motivoCorrente = BLL.getMotivosNaoVenda((int)codigoMotivo, "", out mensagemErro).FirstOrDefault();

                return(View(motivoCorrente));
            }
            else
            {
                return(View());
            }
        }