public ActionResult Insert(CuentasPorPagar newModel)
 {
     if (ModelState.IsValid)
     {
         newModel.InsertCuentasPorPagar();
         return RedirectToAction("Index");
     }
     else
     {
         newModel.listaFacturaHeader = CuentasPorPagar.GetListaFacturaHeader();
         return View(newModel);
     }
 }
        public static List<CuentasPorPagar> GetListaCuentasPorPagar()
        {
            List<CuentasPorPagar> listaCuentasPorPagar = new List<CuentasPorPagar>();
            Data.dsCuentasTableAdapters.CuentasPorPagarTableAdapter Adapter = new Data.dsCuentasTableAdapters.CuentasPorPagarTableAdapter();
            Data.dsCuentas.CuentasPorPagarDataTable dt = Adapter.SelectListaCPP();

            foreach (var dr in dt)
            {
                CuentasPorPagar item = new CuentasPorPagar();
                item.idTransaccion = dr.idTransaccion;
                if (!dr.IsidFacturaHeaderNull())
                    item.idFacturaHeader = dr.idFacturaHeader;
                if (!dr.IsmBalanceNull())
                    item.mBalance = dr.mBalance;

                listaCuentasPorPagar.Add(item);
            }

            return listaCuentasPorPagar;
        }
 // GET: CuentasPorPagar/Insert
 public ActionResult Insert()
 {
     CuentasPorPagar newModel = new CuentasPorPagar();
     newModel.listaFacturaHeader = CuentasPorPagar.GetListaFacturaHeader();
     return View(newModel);
 }
 // GET: CuentasPorPagar/Edit/5
 public ActionResult Edit(int idTransaccion)
 {
     CuentasPorPagar newModel = new CuentasPorPagar(idTransaccion);
     newModel.listaFacturaHeader = CuentasPorPagar.GetListaFacturaHeader();
     return View(newModel);
 }
 // GET: CuentasPorPagar/Details/5
 public ActionResult Details(int idTransaccion)
 {
     CuentasPorPagar newModel = new CuentasPorPagar(idTransaccion);
     return View(newModel);
 }
 public ActionResult Delete(int idTransaccion, CuentasPorPagar newModel)
 {
     Inventario.DeleteInventario(idTransaccion);
     return RedirectToAction("Index");
 }