コード例 #1
0
        public void UnpublishSchedule()
        {
            MongoSchedule publishedSchedule = collection.Find(x => x.Published == true).ToListAsync().Result.First();

            publishedSchedule.Published = false;
            var filter = Builders <MongoSchedule> .Filter.Eq("id", publishedSchedule.id);

            collection.ReplaceOne(filter, publishedSchedule);
        }
コード例 #2
0
        public void PutSchedule(string id, MongoSchedule newSchedule)
        {
            var filter = Builders <MongoSchedule> .Filter.Eq("id", id);

            var update = Builders <MongoSchedule> .Update
                         .Set("Rooms", newSchedule.Rooms)
                         .Set("TimeSlots", newSchedule.TimeSlots);

            collection.UpdateOne(filter, update);
        }
コード例 #3
0
 public void PostSchedule(MongoSchedule schedule)
 {
     collection.InsertOne(schedule);
 }
コード例 #4
0
        public void DeleteSchedule()
        {
            MongoSchedule schedule = collection.Find(x => true).ToListAsync().Result.First();

            collection.DeleteOne(s => s.id == schedule.id);
        }