Exemplo n.º 1
0
 public ActionResult DeleteConfirmed(int?id)
 {
     try
     {
         daoFormaPagamento = new DAOFormaPagamento();
         daoFormaPagamento.Delete(id);
         this.AddFlashMessage(Util.AlertMessage.DELETE_SUCESS);
         return(RedirectToAction("Index"));
     } catch (Exception ex)
     {
         this.AddFlashMessage(ex.Message, FlashMessage.ERROR);
         return(View());
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            try
            {
                var daoFormaPagamentos = new DAOFormaPagamento();

                if (daoFormaPagamentos.Delete(id))
                {
                    TempData["message"] = "Registro excluído com sucesso!";
                    TempData["type"]    = "sucesso";
                }
                return(RedirectToAction("Index"));
            }
            catch
            {
                TempData["message"] = "O registro não pode ser excluído, pois está associado a um estado!";
                TempData["type"]    = "erro";
                return(RedirectToAction("Index"));
            }
        }