public ActionResult _Search(EventDirectorSearchModel searchModel) { if ((searchModel.ApplicationIds == null || !searchModel.ApplicationIds.Any()) && string.IsNullOrWhiteSpace(searchModel.UserEmail) && searchModel.EventId == null) { ModelState.AddModelError("FilterOptions", "At least one filter option must be applied."); } if (!ModelState.IsValid) { return(Json(new { success = false, message = ModelState.GetErrors() }, JsonRequestBehavior.AllowGet)); } var userEmail = searchModel.UserEmail?.Split('|')[1]; var eventDirectorCount = GetEventDirectorListItemsCount(searchModel.EventId, userEmail, searchModel.ApplicationIds, searchModel.IsPrimary, searchModel.IsAssistant); var maxAllowedCount = 5000; if (eventDirectorCount > maxAllowedCount) { return(Json(new { success = false, message = $"Query returned more than {maxAllowedCount} ({eventDirectorCount}) items. Make a more specific search." })); } var model = GetEventDirectorListItems(searchModel.EventId, userEmail, searchModel.ApplicationIds, searchModel.IsPrimary, searchModel.IsAssistant); var json = Json(new { success = true, data = this.RenderRazorViewToString("_List", model) }); json.MaxJsonLength = int.MaxValue; return(json); }
public ActionResult _Search() { var model = new EventDirectorSearchModel { Applications = Applications }; return(PartialView(model)); }