Ejemplo n.º 1
0
        private async Task AddItemAsync()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());

            List <Item> items = new List <Item>()
            {
                new Item()
                {
                    id = "1", number = 11
                },
                new Item()
                {
                    id = "2", number = 22
                },
                new Item()
                {
                    id = "3", number = 33
                }
            };

            await requestHandler.AddItemAsync(items[0]);

            await requestHandler.AddItemAsync(items[1]);

            await requestHandler.AddItemAsync(items[2]);

            Console.WriteLine("Added Item");
        }
Ejemplo n.º 2
0
        public async Task ClasstimeCreateTable()
        {
            TableHandler <Classtime> requestHandler = new TableHandler <Classtime>(TableNameClasstime, new ItemConverterClasstime());
            await requestHandler.CreateTableAsync();

            Console.WriteLine("Table Created");
        }
Ejemplo n.º 3
0
        public async Task DeleteTableAsync()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());
            await requestHandler.DeleteTableAsync();

            Console.WriteLine("Table Deleted");
        }
Ejemplo n.º 4
0
        private async Task DoesTableExistAsync()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());
            bool isExisting = await requestHandler.DoesTableExist();

            Console.WriteLine("Does the Table Exist: {0}", isExisting);
        }
Ejemplo n.º 5
0
        private async Task GetCountAsync()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());

            long count = await requestHandler.GetCountAsync();

            Console.WriteLine("Count: {0}", count);
            Console.WriteLine("All Items Retrieved");
        }
Ejemplo n.º 6
0
        private async Task ClasstimeAddItem()
        {
            TableHandler <Classtime> requestHandler = new TableHandler <Classtime>(TableNameClasstime, new ItemConverterClasstime());

            List <Classtime> items = new List <Classtime>()
            {
                new Classtime()
                {
                    id = "1", classCode = "CS455", building = "L", roomNumber = "218", day = "Monday", startTime = 1630, endTime = 1720
                }
            };

            await requestHandler.AddItemAsync(items[0]);

            Console.WriteLine("Added Item");
        }
Ejemplo n.º 7
0
        private async Task ContainsItemMatchingRoom()
        {
            TableHandler <Classtime> requestHandler = new TableHandler <Classtime>(TableNameClasstime, new ItemConverterClasstime());

            List <Classtime> items = new List <Classtime>()
            {
                new Classtime()
                {
                    id = "1", classCode = "CS455", building = "L", roomNumber = "218", day = "Monday", startTime = 1630, endTime = 1720
                }
            };

            bool tableContains = await requestHandler.ContainsItemMatchingRoom(items[0]);

            Console.WriteLine("Table Contains Item: {0}", tableContains);
        }
Ejemplo n.º 8
0
        private async Task AddMoreThan25InBatch()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());

            List <Item> items = new List <Item>();

            for (int i = 0; i < 30; i++)
            {
                items.Add(new Item()
                {
                    id = i.ToString(), number = i * 10
                });
            }

            await requestHandler.AddItemsInBatchAsync(items);

            Console.WriteLine("Added More Than 25 Items In Batch");
        }
Ejemplo n.º 9
0
        private async Task DeleteItemsInBatchAsync()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());

            List <Item> items = new List <Item>()
            {
                new Item()
                {
                    id = "1", number = 11
                },
                new Item()
                {
                    id = "2", number = 22
                },
                new Item()
                {
                    id = "3", number = 33
                }
            };

            await requestHandler.DeleteItemsInBatchAsync(items);

            Console.WriteLine("Added Items In Batch");
        }
Ejemplo n.º 10
0
        private async Task RemakeTableAsync()
        {
            TableHandler <Item> requestHandler = new TableHandler <Item>(TableName, new ItemConverterItem());

            await requestHandler.DeleteTableAsync();

            await requestHandler.WaitTillTableExists(false);

            Console.WriteLine("Table Doesn't Exist Anymore");

            await requestHandler.CreateTableAsync();

            await requestHandler.WaitTillTableIsStatus(TableStatus.ACTIVE);

            Console.WriteLine("Table Is Active");

            Item item = new Item()
            {
                id = "idfoo", number = 430
            };
            await requestHandler.AddItemAsync(item);

            Console.WriteLine("Items Added");
        }