public ActionResult GrantAccess(OfficeAccessModel roomDocumentModel) { // 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 grant office access to a form group GrantOfficeAccessToFormGroup.GrantAccess(basePath, accessToken, accountId, roomDocumentModel.FormGroupId, roomDocumentModel.OfficeId); ViewBag.h1 = "Access is granted for the office"; ViewBag.message = $"To the office with Id'{roomDocumentModel.OfficeId}' granted access for the form group with id '{roomDocumentModel.FormGroupId}'"; return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
public override IActionResult Get() { base.Get(); // 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 get offices and form groups (OfficeSummaryList offices, FormGroupSummaryList formGroups) = GrantOfficeAccessToFormGroup.GetOfficesAndFormGroups(basePath, accessToken, accountId); OfficeAccessModel = new OfficeAccessModel { Offices = offices.OfficeSummaries, FormGroups = formGroups.FormGroups }; return(View("Eg08", this)); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }