Example #1
0
 public ActionResult Editar(int Id)
 {
     try
     {
         List <CuentaModel> listaBanco = null;
         CuentaModel        model      = new CuentaModel();
         using (CPMEntities datos = new CPMEntities())
         {
             listaBanco = (from d in datos.SP_Bancos(1) select new CuentaModel {
                 IdBanco = d.IdBanco, NombreBanco = d.Nombre
             }).ToList();
             var tabla = datos.CUENTA.Find(Id); model.IdCuenta = tabla.IdCuenta; model.Saldo = tabla.Saldo; model.NCuenta = tabla.NCuenta; model.IdBanco = tabla.IdBanco;
         }
         List <SelectListItem> itemsBanco = listaBanco.ConvertAll(d => { return(new SelectListItem()
             {
                 Text = d.NombreBanco.ToString(), Value = d.IdBanco.ToString(), Selected = false
             }); });
         ViewBag.itemsBanco = itemsBanco;
         return(View(model));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        // GET: Banco
        public ActionResult Index()
        {
            List <BancoModel> lista;

            using (CPMEntities datos = new CPMEntities())
            {
                lista = (from d in datos.SP_Bancos(1) select new BancoModel {
                    IdBanco = d.IdBanco, Nombre = d.Nombre, Correo = d.Correo, Telefono = d.Telefono
                }).ToList();
            }
            return(View(lista));
        }
Example #3
0
        public ActionResult Agregar()
        {
            List <CuentaModel> listaBanco = null;

            using (CPMEntities datos = new CPMEntities())
            {
                listaBanco = (from d in datos.SP_Bancos(1) select new CuentaModel {
                    IdBanco = d.IdBanco, NombreBanco = d.Nombre
                }).ToList();
            }
            List <SelectListItem> itemsBanco = listaBanco.ConvertAll(d => { return(new SelectListItem()
                {
                    Text = d.NombreBanco.ToString(), Value = d.IdBanco.ToString(), Selected = false
                }); });

            ViewBag.itemsBanco = itemsBanco;
            return(View());
        }