/// <inheritdoc /> public Task <List <RecipeLite> > Search(string query, TagFilter tags) { if (query == null) { throw new ArgumentNullException(nameof(query)); } return(SearchApiImplementation.Search(query, tags)); }
public async Task <HttpResponseMessage> Get(HttpRequestMessage req, TraceWriter log) { string id = req.GetQueryNameValuePairs().Where(w => w.Key == "id").FirstOrDefault().Value; if (string.IsNullOrWhiteSpace(id)) { var results = await _searchApi.Search <Driver, Driver>(req, log); bool replaceUnapproved = false; bool.TryParse(req.GetQueryNameValuePairs().Where(w => w.Key == "replaceUnapproved").FirstOrDefault().Value, out replaceUnapproved); return(req.CreateResponse(HttpStatusCode.OK, results)); } var item = await _DriverRepository.GetItemAsync(id); return(req.CreateResponse(HttpStatusCode.OK, item)); }
public async Task <HttpResponseMessage> Get(HttpRequestMessage req, TraceWriter log) { string idString = req.GetQueryNameValuePairs().Where(w => w.Key == "id").FirstOrDefault().Value; if (string.IsNullOrWhiteSpace(idString)) { var results = await _searchApi.Search <Journey, Journey>(req, log); return(req.CreateResponse(HttpStatusCode.OK, results)); } var Journey = await _JourneyService.Get(idString); if (Journey == null) { return(req.CreateResponse(HttpStatusCode.NotFound)); } return(req.CreateResponse(HttpStatusCode.OK, Journey)); }
public async Task <HttpResponseMessage> Get(HttpRequestMessage req, TraceWriter log) { string vehicleId = req.GetQueryNameValuePairs().Where(w => w.Key == "id").FirstOrDefault().Value; if ((await _userDigestService.CurrentUserAsync(req)).AppRole == Role.Driver) { return(req.CreateResponse(HttpStatusCode.Forbidden)); } if (string.IsNullOrWhiteSpace(vehicleId)) { var searchResults = await _searchApi.Search <Vehicle, Vehicle>(req, log); bool replaceUnapproved = false; bool.TryParse(req.GetQueryNameValuePairs().Where(w => w.Key == "replaceUnapproved").FirstOrDefault().Value, out replaceUnapproved); return(req.CreateResponse(HttpStatusCode.OK, searchResults)); } var org = await _vehicleService.GetAsync(vehicleId); return(req.CreateResponse(HttpStatusCode.OK, org)); }
public async Task <HttpResponseMessage> Get(HttpRequestMessage req, TraceWriter log) { if (!await _userDigestService.IsAdminAsync(req)) { return(req.CreateResponse(HttpStatusCode.Forbidden)); } var id = req.GetQueryNameValuePairs().Where(w => w.Key == "id").FirstOrDefault().Value; if (id != null) { var changeRecord = await _changeRecordRepository.GetItemAsync(id); return(req.CreateResponse(HttpStatusCode.OK, changeRecord)); } else { var results = await _searchApi.Search <ChangeRecord, ChangeRecord>(req, log); return(req.CreateResponse(HttpStatusCode.OK, results)); } }
public async Task <IActionResult> Index([FromQuery] SearchRequest request) { var response = await _searchApi.Search(request); return(Ok(response)); }