Exemplo n.º 1
0
        public IActionResult ExportAsJson([FromBody] ElasticSearchRequest request)
        {
            IEnumerable <ScrapedComment> history = CommentScraper.All(request.Query, request.Sort).Data;

            byte[] serialized = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(history));
            return(File(serialized, "application/json-download", "export.json"));
        }
Exemplo n.º 2
0
        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"));
        }