public async Task <PartialViewResult> _IndexGrid(String search) { //Permisos Permisos(ControllerContext.RouteData.Values["controller"].ToString()); ViewBag.NombreListado = Etiquetas.TituloGridTipoNotificacion; //Búsqueda var listado = TipoNotificacionDAL.ListarTipoNotificaciones(); search = !string.IsNullOrEmpty(search) ? search.Trim() : ""; if (!string.IsNullOrEmpty(search))//filter { var type = listado.GetType().GetGenericArguments()[0]; var properties = type.GetProperties(); listado = listado.Where(x => properties .Any(p => { var value = p.GetValue(x); return(value != null && value.ToString().ToLower().Contains(search.ToLower())); })).ToList(); } // Only grid query values will be available here. return(PartialView(await Task.Run(() => listado))); }
public ActionResult Create(TipoNotificacion tipoNotificacion) { try { string nombreTipoNotificacion = (tipoNotificacion.NombreNotificacion ?? string.Empty).ToLower().Trim(); var tarifariosIguales = TipoNotificacionDAL.ListarTipoNotificaciones().Where(s => (s.NombreNotificacion ?? string.Empty).ToLower().Trim() == nombreTipoNotificacion).ToList(); if (tarifariosIguales.Count > 0) { return(Json(new { Resultado = new RespuestaTransaccion { Estado = false, Respuesta = Mensajes.MensajeValidacionNombreTarifario } }, JsonRequestBehavior.AllowGet)); } RespuestaTransaccion resultado = TipoNotificacionDAL.CrearTipoNotificacion(tipoNotificacion); return(Json(new { Resultado = resultado }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Resultado = new RespuestaTransaccion { Estado = false, Respuesta = ex.Message } }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Eliminar(int id) { if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RespuestaTransaccion resultado = TipoNotificacionDAL.EliminarTipoNotificacion(id);// await db.Cabecera.FindAsync(id); //return RedirectToAction("Index"); return(Json(new { Resultado = resultado }, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var tipoNotificacion = TipoNotificacionDAL.ConsultarNotificacion(id.Value); ViewBag.Tiempo = tipoNotificacion.TiempoEspera; if (tipoNotificacion == null) { return(HttpNotFound()); } return(View(tipoNotificacion)); }