private void SaveDataToFile(TicketsJsonModel fullModel)
        {
            var jsonFilePath    = Context.Server.MapPath(PathToJson);
            var serializedModel = JsonConvert.SerializeObject(fullModel);

            System.IO.File.WriteAllText(jsonFilePath, serializedModel);
        }
Beispiel #2
0
        private TicketsJsonModel GetDataFromFile()
        {
            var timeslots = new List <Timeslot>
            {
                new Timeslot {
                    Id = 1, MovieId = 1
                },
                new Timeslot {
                    Id = 2, MovieId = 1
                },
                new Timeslot {
                    Id = 3, MovieId = 1
                },
                new Timeslot {
                    Id = 4, MovieId = 2
                },
                new Timeslot {
                    Id = 5, MovieId = 2
                },
                new Timeslot {
                    Id = 6, MovieId = 2
                }
            };
            var jsonModel = new TicketsJsonModel
            {
                Timeslots = timeslots.ToArray()
            };

            return(jsonModel);
        }