public IActionResult ExportAsCSV([FromBody] ElasticSearchRequest request) { IEnumerable <ScrapedComment> history = CommentScraper.All(request.Query, request.Sort).Data; byte[] serialized = CsvSerialization.Serialize(history, CsvSerialization.MapComment); return(File(serialized, "text/csv", "export.csv")); }
public IActionResult ExportPagesAsCSV([FromBody] ElasticSearchRequest request) { IEnumerable <PageScrapeHistory> history = PageScrapeHistoryRepository.All(request.Query, request.Sort).Data; byte[] serialized = CsvSerialization.Serialize(history, CsvSerialization.MapPageScrape); return(File(serialized, "text/csv", "export.csv")); }