コード例 #1
0
        public static async Task <ContributorsDto> FromAppAsync(IAppEntity app, Resources resources, IUserResolver userResolver, IAppPlansProvider plans, bool invited)
        {
            var users = await userResolver.QueryManyAsync(app.Contributors.Keys.ToArray());

            var result = new ContributorsDto
            {
                Items = app.Contributors
                        .Select(x => ContributorDto.FromDomain(x.Key, x.Value))
                        .Select(x => x.CreateUser(users))
                        .Select(x => x.CreateLinks(resources))
                        .OrderBy(x => x.ContributorName)
                        .ToArray()
            };

            result.CreateInvited(invited);
            result.CreatePlan(app, plans);

            return(result.CreateLinks(resources));
        }
コード例 #2
0
        public static ContributorsDto FromApp(IAppEntity app, IAppPlansProvider plans, ApiController controller, bool isInvited)
        {
            var result = new ContributorsDto
            {
                Items = app.Contributors.Select(x => ContributorDto.FromIdAndRole(x.Key, x.Value, controller, app.Name)).ToArray(),
            };

            if (isInvited)
            {
                result.Metadata = new ContributorsMetadata
                {
                    IsInvited = isInvited.ToString()
                };
            }

            result.MaxContributors = plans.GetPlanForApp(app).MaxContributors;

            return(result.CreateLinks(controller, app.Name));
        }
コード例 #3
0
        public static async Task <ContributorsDto> FromAppAsync(IAppEntity app, ApiController controller, IUserResolver userResolver, IAppPlansProvider plans, bool invited)
        {
            var users = await userResolver.QueryManyAsync(app.Contributors.Keys.ToArray());

            var result = new ContributorsDto
            {
                Items =
                    app.Contributors
                    .Select(x => ContributorDto.FromIdAndRole(x.Key, x.Value))
                    .Select(x => x.WithUser(users))
                    .Select(x => x.WithLinks(controller, app.Name))
                    .OrderBy(x => x.ContributorName)
                    .ToArray()
            };

            result.WithInvited(invited);
            result.WithPlan(app, plans);

            return(result.CreateLinks(controller, app.Name));
        }