public ActionResult Index() { var buscar = _sesionOferta.Get <bool>("buscar_bool_oferta"); ViewBag.BuscarOferta = buscar; var filtro = _sesionOferta.Get <FiltroOfertaModels>("filtro_oferta"); if (filtro == null) { filtro = new FiltroOfertaModels(); } PermisosMostrar(); var pagina = _sesionOferta.Get <int>("pagina_actual"); if (pagina > 0) { ViewBag.Pagina = pagina; } GenerateViewBags(); return(View(filtro)); }
private FiltroOfertaModels MappertoFiltroOfertas(IDictionary <string, string> filtro) { var filtroOfertaModels = new FiltroOfertaModels(); if (filtro.Count != 0) { string value; if (filtro.ContainsKey("Nombre")) { value = filtro["Nombre"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.Nombre = value; } } if (filtro.ContainsKey("Descripcion")) { value = filtro["Descripcion"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.Descripcion = value; } } if (filtro.ContainsKey("Estado")) { value = filtro["Estado"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.EstadoOfertaId = Convert.ToInt32(value); } } if (filtro.ContainsKey("PublicadaDesde")) { value = filtro["PublicadaDesde"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.FechaEntre = Convert.ToDateTime(value); } } if (filtro.ContainsKey("PublicadaHasta")) { value = filtro["PublicadaHasta"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.FechaHasta = Convert.ToDateTime(value); } } if (filtro.ContainsKey("")) { value = filtro["CentroUsuarioId"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.CentroIdUsuario = Convert.ToInt32(value); } } if (filtro.ContainsKey("CentroSearch")) { value = filtro["CentroSearch"]; if (!string.IsNullOrEmpty(value)) { filtroOfertaModels.CentroIdUsuario = Convert.ToInt32(value); } } } return(filtroOfertaModels); }