public ActionResult Pois(int?vanaf, int?desc, string search, int?filter, int?mode) { Session.Remove("stap3"); Session["stap2"] = "Pois"; Session["url2"] = "/../admin/pois"; ViewBag.stap1 = Session["stap1"]; ViewBag.url1 = Session["url1"]; ViewBag.stap2 = Session["stap2"]; ViewBag.url2 = Session["url2"]; //mode 1 = json //mode 0/null = view //desc == 1 -> descending //desc == 0 -> ascending bool DisplayDeleted = false; if (bs.GetUser(User.Identity.Name).Roles.Any(r => r.RoleId == "95311bc7-8180-4c53-9e33-61fd254c21fc")) { DisplayDeleted = true; } if (search == null) { search = ""; } List <Poi> res = new List <Poi>(); if (!filter.HasValue) { filter = 0; } if (!vanaf.HasValue) { vanaf = 0; } if (!desc.HasValue) { desc = 0; } switch ((int)filter) { case 1: //naam if (desc == 1) { res = bs.GetPoi50FromSortNameZA((int)vanaf, search, DisplayDeleted); } else { res = bs.GetPoi50FromSortNameAZ((int)vanaf, search, DisplayDeleted); } break; case 2: //email if (desc == 1) { res = bs.getPoi50FromSortEmailZA((int)vanaf, search, DisplayDeleted); } else { res = bs.getPoi50FromSortEmailAZ((int)vanaf, search, DisplayDeleted); } break; case 3: //address if (desc == 1) { res = bs.getPoi50FromSortAddressZA((int)vanaf, search, DisplayDeleted); } else { res = bs.getPoi50FromSortAddressAZ((int)vanaf, search, DisplayDeleted); } break; case 6: //address if (desc == 1) { res = bs.getPoi50FromSortDeletedZA((int)vanaf, search, DisplayDeleted); } else { res = bs.getPoi50FromSortDeletedAZ((int)vanaf, search, DisplayDeleted); } break; default: if (desc == 1) { res = bs.GetPoi50FromSortNameZA((int)vanaf, search, DisplayDeleted); } else { res = bs.GetPoi50FromSortNameAZ((int)vanaf, search, DisplayDeleted); } break; } ViewBag.vanaf = vanaf; ViewBag.desc = desc; ViewBag.filter = filter; if (!mode.HasValue || (int)mode == 0) { return(View(res)); } else { return(Json(JsonConvert.SerializeObject(res), JsonRequestBehavior.AllowGet)); } }