public async Task<HttpResponseMessage> Get(string id) { // Complete Task Async return await Task.Factory.StartNew(() => { FlickrService service = new FlickrService(System.Configuration.ConfigurationManager.AppSettings["FlickrKey"]); PhotoInfo photo = service.GetPhoto(id).Result; return Request.CreateResponse<PhotoInfo>(HttpStatusCode.OK, photo); }); }
public async Task<HttpResponseMessage> Get() { // Complete Task Async return await Task.Factory.StartNew(() => { FlickrService service = new FlickrService(System.Configuration.ConfigurationManager.AppSettings["FlickrKey"]); List<Photo> photos = service.GetPhotos("72157639289695025").Result; return Request.CreateResponse<List<Photo>>(HttpStatusCode.OK, photos); }); }