public async Task <ResourceResultModel> SubmitApprenticeSearchRequest(SupportServiceResourceKey key, string hashedAccountId, ApprenticeshipSearchType searchType, string searchTerm) { var resource = _serviceConfiguration.GetResource(key); var siteUri = _serviceConfiguration.FindSiteBaseUriForManfiestElement(_sites, key); var resourceSearchItemsUrl = resource.SearchItemsUrl; resourceSearchItemsUrl = resourceSearchItemsUrl .Replace("{0}", hashedAccountId) .Replace("{1}", $"{searchType}") .Replace("{2}", HttpUtility.HtmlEncode(searchTerm)); var searchUri = new Uri(siteUri, resourceSearchItemsUrl); ResourceResultModel result = new ResourceResultModel { Resource = await _siteConnector.Upload <string>(searchUri, string.Empty), StatusCode = _siteConnector.LastCode, Exception = _siteConnector.LastException }; return(result); }
public async Task <ActionResult> SearchRequest(string hashedAccountId, ApprenticeshipSearchType searchType, string searchTerm) { ApprenticeshipSearchQuery searchQuery = new ApprenticeshipSearchQuery() { HashedAccountId = hashedAccountId, SearchType = searchType, SearchTerm = searchTerm }; switch (searchQuery.SearchType) { case ApprenticeshipSearchType.SearchByUln: return(await UlnSearch(searchQuery)); case ApprenticeshipSearchType.SearchByCohort: return(await CohortSearch(searchQuery)); } return(View(searchQuery)); }