private void WriteToFileDealers(string path, IEnumerable <JsonDealerReportModel> reportCollection) { foreach (var rep in reportCollection) { var data = new JsonDealerReportModel { Company = rep.Company, CountryId = rep.CountryId, Address = rep.Address }; string json = JsonConvert.SerializeObject(data, Formatting.Indented); using (StreamWriter sw = new StreamWriter(path + rep.Company + ".json")) { sw.WriteLine(json); } } }
private void WriteToFileDealers(string path, IEnumerable<JsonDealerReportModel> reportCollection) { foreach (var rep in reportCollection) { var data = new JsonDealerReportModel { Company = rep.Company, CountryId = rep.CountryId, Address = rep.Address }; string json = JsonConvert.SerializeObject(data, Formatting.Indented); using (StreamWriter sw = new StreamWriter(path + rep.Company + ".json")) { sw.WriteLine(json); } } }