public async Task <CollectionCandidates> GetAsync() { CollectionCandidates collectionCandidates = new CollectionCandidates(); List <Candidate> candidatess = await _candidatesService.GetCandidatesList(); collectionCandidates.Candidates = candidatess; return(collectionCandidates); }
public Task <IEnumerable <Candidate> > getCandidates() { using (var webClient = new System.Net.WebClient()) { string rawJSON = webClient.DownloadString("https://localhost:44388/api/candidates/getall"); //string rawJSON = webClient.DownloadString("http://dmitrogeras-eval-test.apigee.net/votesystem/api/candidates/getall"); CollectionCandidates collectionCandidates = JsonConvert.DeserializeObject <CollectionCandidates>(rawJSON); IEnumerable <Candidate> res = collectionCandidates.Candidates; return(Task.FromResult(res)); } }