// GET: Gasto/Details/5
        public async Task <IActionResult> Details(string filter, int?consumo,
                                                  int?pago, int?pageNumber, string sortOrder, string desde,
                                                  string hasta, int idconsumo, int idpago)
        {
            ViewData["CurrentSort"]   = sortOrder;
            ViewData["CurrentFilter"] = filter;
            ViewData["DateSort"]      = sortOrder == "date" ? "date_desc" : "date";
            ViewData["MontoSort"]     = sortOrder == "monto" ? "monto_desc" : "monto";
            ViewBag.IdConsumo         = _consumo.GetConsumos("");
            ViewBag.IdPago            = _pago.GetPagos("");
            var type   = consumo != null ? consumo : pago;
            var gastos = filter != ""
                ? await _gasto.GetGastosByFilter(filter, type)
                : await _gasto.GetGastosP("");

            gastos = sortOrder != "" ?  _gasto.Sorter(gastos, sortOrder) : gastos;
            if (desde != null)
            {
                var model = new SearchViewModel
                {
                    Desde     = Convert.ToDateTime(desde),
                    Hasta     = Convert.ToDateTime(hasta),
                    IdConsumo = idconsumo,
                    IdPago    = idpago
                };
                gastos = await _gasto.SearchGastos(model);

                gastos        = sortOrder != "" ?  _gasto.Sorter(gastos, sortOrder) : gastos;
                ViewBag.Model = model;
            }
            int pageSize = 5;

            return(View(await PaginatedList <Gasto> .CreateAsync(gastos, pageNumber ?? 1, pageSize)));
        }
 // GET: Mantenimiento/Create
 public ActionResult CreatePago(int?id, string sortOrder)
 {
     ViewData["CodeSort"]    = String.IsNullOrEmpty(sortOrder) ? "code_desc" : "";
     ViewData["DateSort"]    = sortOrder == "date" ? "date_desc" : "date";
     ViewData["DescripSort"] = sortOrder == "descrip" ? "descrip_desc" : "descrip";
     if (id != null)
     {
         ViewBag.Pagos = sortOrder != "" ? _pago.GetPagos(sortOrder) : _pago.GetPagos("");
         return(View(_pago.GetPagoById(id.Value)));
     }
     ViewBag.Pagos = sortOrder != "" ? _pago.GetPagos(sortOrder) : _pago.GetPagos("");
     return(View());
 }