Esempio n. 1
0
        // GET: Transaccion/Create
        //public ActionResult Create()
        //{
        //    ViewBag.CuentaIdOrigen = new SelectList(_repoCuentas.Listar(), "Id", "Nombre");
        //    ViewBag.CuentaIdDestino = new SelectList(_repoCuentas.Listar(), "Id", "Nombre");
        //    ViewBag.Fecha = DateTime.Now;
        //    return View();
        //}

        public ActionResult Crud(int id = 0)
        {
            var trans = (id > 0 ? _repository.Devolver(id)
                        : transaccion);

            _montoViejo = trans.Monto;

            ViewBag.CuentaIdOrigen  = new SelectList(_repoCuentas.Listar(), "Id", "Nombre", trans.CuentaIdOrigen);
            ViewBag.CuentaIdDestino = new SelectList(_repoCuentas.Listar(), "Id", "Nombre", trans.CuentaIdDestino);
            if (id == 0)
            {
                trans.Fecha = DateTime.Now;
            }
            return(View(trans));
        }
        public ActionResult Crud(int id = 0)
        {
            var mov = (id > 0 ? db.Devolver(id)
                        : _Movimiento);

            if (mov.Id == 0)
            {
                mov.Fecha = DateTime.Now;
            }
            else
            {
                _montoEdicion   = mov.Monto;
                _cuentaAnterior = mov.CuentaId;
                _tipo           = mov.Tipo;
            }
            ViewBag.CategoriaId    = new SelectList(catdb.Listar(), "Id", "Nombre", mov.CategoriaId);
            ViewBag.CuentaId       = new SelectList(cuentaDB.Listar(), "Id", "Nombre", mov.CuentaId);
            ViewBag.SubCategoriaId = new SelectList(subcatdb.Listar(), "Id", "Nombre", mov.SubCategoriaId);
            return(View(mov));
        }
Esempio n. 3
0
 // GET: Cuenta
 public ActionResult Index()
 {
     ViewBag.Total = _repository.CalcularTotal();
     ViewBag.Menu  = GeneraMenu();
     return(View(_repository.Listar()));
 }