// GET: CuentaAbono
        public ActionResult Index()
        {
            List <CuentaAbono> List = null;

            try
            {
                DBMysql dBMysql1 = new DBMysql();
                dBMysql1.OpenConnection();
                CuentaAbono CuentaAbono_ = new CuentaAbono(dBMysql1);
                List = CuentaAbono_.List();
                //List = NotaPedido_.ListByPedido(id);
                dBMysql1.CloseConnection();
                return(View(List));
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public ActionResult Create(CuentaAbono CuentaAbono_)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View(CuentaAbono_));
         }
         DBMysql dBMysql1 = new DBMysql();
         dBMysql1.OpenConnection();
         CuentaAbono_.SetConnection(dBMysql1);
         int Result = CuentaAbono_.Create();
         dBMysql1.CloseConnection();
         if (Result == 0)
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError(string.Empty, string.Format("No se ha podido registrar"));
             return(View(CuentaAbono_));
         }
     }
     catch (DBException ex)
     {
         ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
         return(View(CuentaAbono_));
     }
     catch (MySqlException ex)
     {
         ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
         return(View(CuentaAbono_));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
         return(View(CuentaAbono_));
     }
 }
 public ActionResult Edit(CuentaAbono CuentaAbono_)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             throw new Exception("Campos vacios");
         }
         DBMysql dBMysql1 = new DBMysql();
         dBMysql1.OpenConnection();
         CuentaAbono_.SetConnection(dBMysql1);
         int Result = CuentaAbono_.Update();
         dBMysql1.CloseConnection();
         if (Result == 0)
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View());
         }
     }
     catch (DBException ex)
     {
         ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
         return(View(CuentaAbono_));
     }
     catch (MySqlException ex)
     {
         ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
         return(View(CuentaAbono_));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
         return(View(CuentaAbono_));
     }
 }
        // GET: CuentaAbono/Details/5
        public ActionResult Details(int id)
        {
            try
            {
                DBMysql dBMysql1 = new DBMysql();
                dBMysql1.OpenConnection();
                CuentaAbono CuentaAbono_ = new CuentaAbono(dBMysql1);
                bool        isExists     = CuentaAbono_.GetById(id);

                dBMysql1.CloseConnection();
                if (isExists)
                {
                    return(View(CuentaAbono_));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, string.Format("No se ha encontrado el registro"));
                    return(View(CuentaAbono_));
                }
            }
            catch (DBException ex)
            {
                ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
                return(View());
            }
            catch (MySqlException ex)
            {
                ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
                return(View());
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, string.Format("System Error: {0}", ex.Message));
                return(View());
            }
        }