Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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"));
        }
Exemple #3
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <PoliceStationInfo> > .Write(await db.PoliceStations.Include(s => s.PublicPhone).ToListAsync())));
 }
Exemple #4
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <TransportNodeInfo> > .Write(await db.TransportNodes.ToListAsync())));
 }
Exemple #5
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <PriorityproductInfo> > .Write(await db.Priorityproducts.ToListAsync())));
 }
Exemple #6
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <HotelInfo> > .Write(await db.Hotels.Include(s => s.ContactPhone).ToListAsync())));
 }
Exemple #7
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <FootballFieldInfo> > .Write(await db.FootballFields.Include(s => s.WorkingHoursWinter).ToListAsync())));
 }
Exemple #8
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <RestroomInfo> > .Write(await db.Place.Include(s => s.WorkingHours).ToListAsync())));
 }
Exemple #9
0
 public async Task <IActionResult> Show()
 {
     return(Ok(JWriter <List <CompetitionsListInfo> > .Write(await db.CompetitionsLists.Include(s => s.WebSite).ToListAsync())));
 }