public void SearchInitialize(string searchType = "", bool getAll = false) { if (string.IsNullOrWhiteSpace(searchType)) { searchType = "credential"; } SearchInitialize query = new SearchInitialize() { SearchType = searchType }; DoInitialize(query); }
public void Load(SearchInitialize query) { if (query == null) { query = new SearchInitialize() { SearchType = "credential" }; } if (string.IsNullOrWhiteSpace(query.SearchType)) { query.SearchType = "credential"; } DoInitialize(query); }
private void DoInitialize(SearchInitialize query) { if (query == null) { query = new SearchInitialize() { SearchType = "credential" }; } if (string.IsNullOrWhiteSpace(query.SearchType)) { query.SearchType = "credential"; } List <string> messages = new List <string>(); var response = new ApiResponse(); var searchType = query.SearchType.ToLower(); var results = new JObject(); switch (searchType.ToLower()) { case "credential": //this needs to be a generic class var credentialFilters = API.SearchServices.GetCredentialFilters(query.GetAll); response.Result = credentialFilters; break; case "organization": { var filters = API.SearchServices.GetOrganizationFilters(query.GetAll); response.Result = filters; break; } case "assessment": //this needs to be a generic class var asmtFilters = API.SearchServices.GetAssessmentFilters(query.GetAll); response.Result = asmtFilters; break; case "learningopportunity": { var loppFilters = API.SearchServices.GetLearningOppFilters(query.GetAll); response.Result = loppFilters; break; } case "pathway": { var pwFilters = API.SearchServices.GetPathwayFilters(query.GetAll); response.Result = pwFilters; break; } case "competencyframework": { var pwFilters = API.SearchServices.GetNoFilters("Competency Framework"); response.Result = pwFilters; break; } case "conceptscheme": { var pwFilters = API.SearchServices.GetNoFilters("Concept Scheme"); response.Result = pwFilters; break; } case "transfervalue": { var pwFilters = API.SearchServices.GetNoFilters("Transfer Value"); response.Result = pwFilters; break; } case "pathwayset": { var pwFilters = API.SearchServices.GetNoFilters("Pathway Set"); response.Result = pwFilters; break; } default: { valid = false; messages.Add("Unknown search mode: " + searchType); break; } } if (messages.Any()) { SendResponse(messages); } else { response.Successful = true; //response.Result = results; //var finalResult = JObject.FromObject( new { data = results, valid = valid, status = status } ); SendResponse(response); } }