public async Task <IActionResult> OnGet() { TDMemberProfile profile; try { profile = await _teamDirectoryClient.Profiles.GetProfileAsync(ProfileIdentifier.Id(User.Identity !.GetClaimValue(SpaceClaimTypes.UserId) !)); } catch (NotFoundException) { return(NotFound()); } BookUrl = Request.GetDisplayUrl().SubstringBefore("/enable", StringComparison.OrdinalIgnoreCase) + Url.Page(nameof(Index), new { username = profile.Username }); // If no settings exist, enable booking with default values if (!_settingsStorage.HasSettings(profile.Username)) { await _settingsStorage.Store(profile.Username, new BookSomeSpaceSettings { Enabled = true, Username = profile.Username, MinHourUtc = 7, MaxHourUtc = 15, MinScheduleNoticeInHours = 1, NotifyViaChat = true }); } var settings = await _settingsStorage.Retrieve(profile.Username); Enabled = settings.Enabled; MinHourUtc = settings.MinHourUtc; MaxHourUtc = settings.MaxHourUtc; MinScheduleNoticeInHours = settings.MinScheduleNoticeInHours; NotifyViaChat = settings.NotifyViaChat; return(Page()); }