static public void Write(T data) { string current_data; try { current_data = File.ReadAllText(path, Encoding.Default); using (StreamWriter sw = new StreamWriter(path, false, System.Text.Encoding.Default)) { if (data != null) { sw.WriteLine(JWriter <T> .Write(data, current_data)); } else { sw.WriteLine(); } } } catch (System.Exception ex) { throw new System.Exception(ex.Message); } }
public async Task <IActionResult> Export() { try { using (StreamWriter sw = new StreamWriter("DataFile.json", false, System.Text.Encoding.Default)) { sw.WriteLine(JWriter <List <PoliceStationInfo> > .Write(await db.PoliceStations.Include(s => s.PublicPhone).ToListAsync())); } } catch (Exception ex) { throw new Exception(ex.Message); } return(Ok("Данные экспортированны в формат .json")); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <PoliceStationInfo> > .Write(await db.PoliceStations.Include(s => s.PublicPhone).ToListAsync()))); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <TransportNodeInfo> > .Write(await db.TransportNodes.ToListAsync()))); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <PriorityproductInfo> > .Write(await db.Priorityproducts.ToListAsync()))); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <HotelInfo> > .Write(await db.Hotels.Include(s => s.ContactPhone).ToListAsync()))); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <FootballFieldInfo> > .Write(await db.FootballFields.Include(s => s.WorkingHoursWinter).ToListAsync()))); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <RestroomInfo> > .Write(await db.Place.Include(s => s.WorkingHours).ToListAsync()))); }
public async Task <IActionResult> Show() { return(Ok(JWriter <List <CompetitionsListInfo> > .Write(await db.CompetitionsLists.Include(s => s.WebSite).ToListAsync()))); }