// GET: SubCategoria/Create public ActionResult Create(int?Id) { //SI ARRASTRA POR GET UN CODIGO DE CATEGORIA, LO CARGA Y DESHABILITA EL COMBO DE CATEGORIA PARA CARGAR SOLO SUB CATEGORIA A ESA CATEGORIA if (Id.HasValue) { ViewBag.TieneCategoria = true; ViewBag.CategoriaId = new SelectList(new List <CategoriaModel>() { dc.Devolver(Convert.ToInt32(Id)) }, "Id", "Nombre"); } else { ViewBag.tieneCategoria = false; ViewBag.CategoriaId = new SelectList(dc.Listar(), "Id", "Nombre"); } return(View()); }
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)); }
public IActionResult Get() { var result = _contexto.Listar(); if (result == null) { return(NotFound()); } return(Ok(result)); }
public IActionResult Listar() { return(Ok(categoriasRepository.Listar())); }
// GET: Categoria public ActionResult Index() { ViewBag.Menu = GeneraMenu(); return(View(db.Listar())); }