Пример #1
0
        private void FullFillDBWithFurniture()
        {
            IRoomFurniture roomfurn;
            List<IRoom> rooms = new List<IRoom>();

            using (DataBaseConnector dbService = new DataBaseConnector())
            {

                rooms = dbService.GetAllRecords<IRoom>();
                foreach ( var room in rooms)
                {

                    roomfurn = new RoomFurnitureDBModel();
                    roomfurn.UUID = Guid.NewGuid().ToString();
                    roomfurn.RoomUUID = room.UUID;
                    roomfurn.FurnitureUnit = "Кровать";
                    roomfurn.Quantity = 2;
                    dbService.HandleRoomFurnituresTable(roomfurn,null,RecordActions.Inserted);

                    roomfurn.UUID = Guid.NewGuid().ToString();
                    roomfurn.FurnitureUnit = "Стул";
                    roomfurn.Quantity = 2;
                    dbService.HandleRoomFurnituresTable(roomfurn, null, RecordActions.Inserted);

                    roomfurn.UUID = Guid.NewGuid().ToString();
                    roomfurn.FurnitureUnit = "Стол";
                    roomfurn.Quantity = 1;
                    dbService.HandleRoomFurnituresTable(roomfurn, null, RecordActions.Inserted);

                    roomfurn.UUID = Guid.NewGuid().ToString();
                    roomfurn.FurnitureUnit = "Шкаф";
                    roomfurn.Quantity = 2;
                    dbService.HandleRoomFurnituresTable(roomfurn, null, RecordActions.Inserted);

                    roomfurn.UUID = Guid.NewGuid().ToString();
                    roomfurn.FurnitureUnit = "Полочка";
                    roomfurn.Quantity = 3;
                    dbService.HandleRoomFurnituresTable(roomfurn, null, RecordActions.Inserted);
                }
                dbService.SaveChanges();
            }
        }