コード例 #1
0
        public async Task <OrganizationDto> Get(int organizationId)
        {
            var org = await _organizationRetrievalService
                      .GetOrganizationByIdAsync(organizationId);

            return(new OrganizationDto(org));
        }
コード例 #2
0
        public async Task <IActionResult> Put(int organizationId, string userId)
        {
            var user = await _userRetrievalService.GetUserByIdAsync(userId);

            var org = await _orgRetrievalService.GetOrganizationByIdAsync(organizationId);

            await _orgMemberService.AddToOrganizationAsync(user, org);

            return(Ok());
        }
コード例 #3
0
        public async Task <string[]> List(int organizationId, string userId, CancellationToken token)
        {
            var user = await _userRetrievalService.GetUserByIdAsync(userId,
                                                                    new UserRetrievalOptions
            {
                IncludeOrgMembership = true
            }, token);

            await _organizationRetrievalService.GetOrganizationByIdAsync(organizationId); // just to check its existence

            return(user.OrganizationMembership
                   .FirstOrDefault(m => m.OrganizationId == organizationId)
                   ?.Roles.Select(r => r.Role)
                   .OrderBy(r => r)
                   .ToArray()
                   ?? Array.Empty <string>());
        }
コード例 #4
0
        public async Task <IActionResult> OnGetAsync(int id)
        {
            Organization = await _organizationRetrievalService.GetOrganizationByIdAsync(id, new OrganizationRetrievalOptions
            {
                LoadHostnames = true
            });

            return(Page());
        }
コード例 #5
0
        public async Task <OrganizationSettingDto[]> List(int organizationId, CancellationToken cancellationToken)
        {
            await _organizationRetrievalService
            .GetOrganizationByIdAsync(organizationId,
                                      cancellationToken : cancellationToken); // to check for org existence

            var settings = await _organizationSettingsCache
                           .GetAllSettingsForOrganizationAsync(organizationId);

            var values = settings.ToDictionary(
                s => s.Name,
                s => s.Value);

            return(_organizationSettingsRegistry.GetEntries()
                   .OrderBy(e => e.Section)
                   .ThenBy(e => e.Name)
                   .Select(e => new OrganizationSettingDto(e)
            {
                Value = values.ContainsKey(e.Name) ? values[e.Name] : null
            }).ToArray());
        }
コード例 #6
0
ファイル: Details.cshtml.cs プロジェクト: losol/eventuras
        private async Task <IActionResult> PageAsync(int id)
        {
            var org = await _organizationRetrievalService.GetOrganizationByIdAsync(id, new OrganizationRetrievalOptions
            {
                LoadHostnames = true
            });

            Organization ??= org;

            if (Organization == null)
            {
                return(NotFound());
            }

            Hostnames ??= org.CommaSeparatedHostnames;

            return(Page());
        }