public async Task <HttpResponseMessage> Delete(HttpRequestMessage req, TraceWriter log) { string id = 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(id)) { return(req.CreateResponse(HttpStatusCode.NotFound)); } var Journey = await _JourneyRepository.GetItemAsync(id); if (Journey == null) { return(req.CreateResponse(HttpStatusCode.NotFound)); } Journey = await _JourneyService.DeleteAsync(Journey, req); return(req.CreateResponse(HttpStatusCode.OK, Journey)); }