Beispiel #1
0
        public ActionResult ExportData(RoomFormModel roomFormModel)
        {
            // Obtain your OAuth token
            string accessToken = RequestItemsService.User.AccessToken;                      // Represents your {ACCESS_TOKEN}
            var    basePath    = $"{RequestItemsService.Session.RoomsApiBasePath}/restapi"; // Base API path
            string accountId   = RequestItemsService.Session.AccountId;                     // Represents your {ACCOUNT_ID}

            try
            {
                // Call the Rooms API to add form to a room
                var roomDocument = AddingFormToRoom.AddForm(basePath,
                                                            accessToken,
                                                            accountId,
                                                            roomFormModel.RoomId,
                                                            roomFormModel.FormId);

                ViewBag.h1          = "The form was successfully added to a room";
                ViewBag.message     = $"Results from the Rooms: AddFormToRoom method. RoomId: {roomFormModel.RoomId}, FormId: {roomFormModel.FormId} :";
                ViewBag.Locals.Json = JsonConvert.SerializeObject(roomDocument, Formatting.Indented);

                return(View("example_done"));
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode    = apiException.ErrorCode;
                ViewBag.errorMessage = apiException.Message;

                return(View("Error"));
            }
        }