/*public ActionResult ImportInformation() * { * return View(); * } * * [HttpPost] * public ActionResult ImportInformation(IEnumerable<HttpPostedFileBase> attachments, String type) * { * // The Name of the Upload component is "attachments" * if (attachments != null) * { * foreach (var file in attachments) * { * // Some browsers send file names with full path. We only care about the file name. * var fileName = Path.GetFileName(file.FileName); * var destinationPath = Path.Combine(Server.MapPath("~/App_Data"), fileName); * * file.SaveAs(destinationPath); * ImportExport importExport = new ImportExport(); * List<ImportPlotObject> plotList = null; * List<ImportGeometryObject> subPlotList = null; * if (type == "Plot") * { * plotList = importExport.PlotBatchImport(file.InputStream); * ViewData["Plot"] = plotList; * } * else * { * subPlotList = importExport.SubPlotBatchImport(file.InputStream); * ViewData["SubPlot"] = subPlotList; * } * * //new StreamReader(inputFile.InputStream) * } * * } * * // Redirect to a view showing the result of the form submission. * return View(); * }*/ /// <summary> /// export plots to a CSV file /// </summary> /// <returns>CSV file</returns> public ActionResult ExportAllPlots() { ImportExport importExport = new ImportExport(); //byte[] csvData = importExport.ExportAllPlots(); return(File(Encoding.ASCII.GetBytes(importExport.ExportAllPlots()), "text/csv", "PlotList.csv")); }
/// <summary> /// export plots to a CSV file /// </summary> /// <returns>CSV file</returns> public ActionResult ExportAllPlots(bool withSubplots = false) { ImportExport importExport = new ImportExport(); return(File(Encoding.ASCII.GetBytes(importExport.ExportAllPlots()), "text/csv", "PlotList.csv")); }