public async Task <HttpResponseMessage> GetAsync() { string activityId = GetHeaderValueOrDefault(Request, activityHeader, () => { return(Guid.NewGuid().ToString()); }); ServiceEventSource.Current.ServiceRequestStart("VotesController.Get", activityId); IReadOnlyList <VotingData> counts = await _service.GetVotingDataAsync(activityId, CancellationToken.None); List <KeyValuePair <string, int> > votes = new List <KeyValuePair <string, int> >(counts.Count); foreach (VotingData data in counts) { votes.Add(new KeyValuePair <string, int>(data.Name, data.Count)); } var response = Request.CreateResponse(HttpStatusCode.OK, votes); response.Headers.CacheControl = new CacheControlHeaderValue() { NoCache = true, MustRevalidate = true }; ServiceEventSource.Current.ServiceRequestStop("VotesController.Get", activityId); _service.RequestCount = 1; return(response); }