private void WriteToFileIncomes(string path, IEnumerable <JsonIncomeReportModel> reportCollection) { foreach (var rep in reportCollection) { var data = new JsonIncomeReportModel { Date = rep.Date, DealerId = rep.DealerId, Amount = rep.Amount }; string json = JsonConvert.SerializeObject(data, Formatting.Indented); using (StreamWriter sw = new StreamWriter(path + rep.DealerId + rep.Date.Day + rep.Date.Month + rep.Date.Year + ".json")) { sw.WriteLine(json); } } }
private void WriteToFileIncomes(string path, IEnumerable<JsonIncomeReportModel> reportCollection) { foreach (var rep in reportCollection) { var data = new JsonIncomeReportModel { Date = rep.Date, DealerId = rep.DealerId, Amount = rep.Amount }; string json = JsonConvert.SerializeObject(data, Formatting.Indented); using (StreamWriter sw = new StreamWriter(path + rep.DealerId + rep.Date.Day + rep.Date.Month + rep.Date.Year + ".json")) { sw.WriteLine(json); } } }