コード例 #1
0
        public static void CreateClassRooms(int number, int building, int floor, int capacity, string description)
        {
            StorageCredentials creds = new StorageCredentials(accountName, accountKey);
            CloudStorageAccount storageAccount = new CloudStorageAccount(creds, useHttps: true);

            // Create the table client.
            CloudTableClient classRoomClient = storageAccount.CreateCloudTableClient();

            // Create the table if it doesn't exist.
            CloudTable table = classRoomClient.GetTableReference("ClassRoom");
            table.CreateIfNotExists();

            // Create the entity.
            ClassRoomEntity foo = new ClassRoomEntity(number, building);

            foo.Floor = floor;
            foo.Capacity = capacity;
            foo.Description = description;

            // Create the TableOperation that inserts the customer entity.
            TableOperation insertOperation = TableOperation.Insert(foo);

            // Execute the insert operation.
            table.Execute(insertOperation);
        }
コード例 #2
0
        public ActionResult PostClassRoom(ClassRoomEntity foo)
        {
            Facade proxy = new Facade();
            ViewBag.ClassRooms = proxy.GetClassRooms();
            proxy.InsertClassRoom(foo.Number, foo.Building, foo.Floor, foo.Capacity, foo.Description);

            return RedirectToAction("Index");
        }