public async Task<ActionResult> DownloadsInfo() { SourceCodeDownloadsManager manager = new SourceCodeDownloadsManager(); IList<DownloadInfo> model = await manager.GetDownloadsInfoAsync(); return View(model); }
public FileResult DownloadExample(String id) { String downloadLink = ConfigurationManager.AppSettings[String.Format("{0}ExampleUrl", id)]; if (downloadLink == null) return null; SourceCodeDownloadsManager manager = new SourceCodeDownloadsManager(); manager.CreateDownloadAsync(id); byte[] data; using (WebClient webClient = new WebClient()) { webClient.Headers.Add("Accept", "application/zip"); webClient.Headers.Add("user-agent", ConfigurationManager.AppSettings["UserAgent"]); data = webClient.DownloadData(downloadLink); } return File(data, "application/zip", String.Format("{0}Example.zip", id)); }