Пример #1
0
        public CalendarForGroup GetSchedule(string idName)
        {
            string SchedulePath = shedulerPath + Path.DirectorySeparatorChar + idName + ".json";

            string scheduleJson = File.ReadAllText(SchedulePath);

            CalendarForGroup Schedule = JsonConvert.DeserializeObject <CalendarForGroup>(scheduleJson);

            return(Schedule);
        }
Пример #2
0
        public CalendarForGroup CreateUpdateSchedule(CalendarForGroup schedule)
        {
            int lenthId = AllGetSchedule().Count() + 1;

            schedule.Id = lenthId;
            string newSchedulePath = shedulerPath + Path.DirectorySeparatorChar + schedule.Name + ".json";

            // string newSchedulePath = Path.Combine(shedulerPath, $"{ Path.DirectorySeparatorChar}", fileName);
            File.WriteAllText(newSchedulePath, JsonConvert.SerializeObject(schedule));
            return(schedule);
        }