Пример #1
0
        public async Task <string> DownloadCsv(string deskId, DateTime date)
        {
            var plDetails = await _profitLossRepository.GetDailyPLTradeAsync(deskId, date);

            var deskData = _mapper.Map <PLDataExportDm>(plDetails);

            //var deskHR = CSVUtil<PLDataExportDm>.ConvertHeaderRow(deskData);
            var tradeHR = CSVUtil <DailyPLTradeDm> .ConvertHeaderRow(plDetails.DailyPLTrades[0]);

            //var finalHR = deskHR + "," + tradeHR + Environment.NewLine;
            //var dailyDeskCsv = CSVUtil<PLDataExportDm>.ConvertObjectToCSV(new List<PLDataExportDm> { deskData });
            var transactCsv = CSVUtil <DailyPLTradeDm> .ConvertObjectToCSV(plDetails.DailyPLTrades);

            //var finalDataCsv = finalHR + Environment.NewLine + dailyDeskCsv + "," + transactCsv;
            var finalDataCsv = tradeHR + Environment.NewLine + transactCsv;

            return(finalDataCsv);
        }