public async Task <ActionResult> CsvDestination() { var content = await _placeService.GetCsvFormat(); string csv = TypeConversions.jsonToCSV(content, ","); HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new StringContent(csv); result.Content.Headers.ContentType = new MediaTypeHeaderValue("text/csv"); result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = "destinations.csv" }; return(View(result)); }