Пример #1
0
        public async Task <bool> CreateRoomReservationInfo(RoomReservationInfo roomReservationInfo)
        {
            var mongoDatabase   = this.client.GetDatabase(MongoDbManager.database);
            var mongoCollection = mongoDatabase.GetCollection <RoomReservationInfo>(MongoDbManager.collection);
            await mongoCollection.InsertOneAsync(roomReservationInfo);

            return(true);
        }
Пример #2
0
        public async Task <bool> Delete(RoomReservationInfo roomReservationInfo)
        {
            var mongoDatabase   = this.client.GetDatabase(MongoDbManager.database);
            var mongoCollection = mongoDatabase.GetCollection <RoomReservationInfo>(MongoDbManager.collection);

            var result = await mongoCollection.DeleteOneAsync <RoomReservationInfo>(
                r => r.Id == roomReservationInfo.Id && r.Room == roomReservationInfo.Room);

            return(true);
        }
Пример #3
0
        public async Task <bool> UpdateTitle(RoomReservationInfo roomReservationInfo)
        {
            var mongoDatabase   = this.client.GetDatabase(MongoDbManager.database);
            var mongoCollection = mongoDatabase.GetCollection <RoomReservationInfo>(MongoDbManager.collection);

            var result = await mongoCollection.UpdateOneAsync <RoomReservationInfo>(
                r => r.Id == roomReservationInfo.Id && r.Room == roomReservationInfo.Room,
                new UpdateDefinitionBuilder <RoomReservationInfo>().Set(i => i.Title, roomReservationInfo.Title));

            return(true);
        }
Пример #4
0
        public static void CreateRoomReservationInfo()
        {
            MongoDbManager manager = new MongoDbManager();

            RoomReservationInfo roomReservationInfo = new RoomReservationInfo();

            roomReservationInfo.Id               = "A0000000001";
            roomReservationInfo.Room             = "第1会議室";
            roomReservationInfo.ReservedUserId   = "daigo";
            roomReservationInfo.ReservedUserName = "******";
            roomReservationInfo.Title            = "MongoDB導入打ち合わせ";
            roomReservationInfo.Start            = new DateTime(2017, 7, 5, 10, 0, 0);
            roomReservationInfo.End              = new DateTime(2017, 7, 5, 12, 0, 0);
            roomReservationInfo.AssignMembers    = new List <AssignMember>();
            roomReservationInfo.AssignMembers.Add(
                new AssignMember()
            {
                UserId = "sakata", UserName = "******"
            });

            bool result = manager.CreateRoomReservationInfo(roomReservationInfo).Result;
        }