Ejemplo n.º 1
0
        public IActionResult GetContributors(string app)
        {
            var response = ContributorsDto.FromApp(App, appPlansProvider);

            Response.Headers["ETag"] = App.Version.ToString();

            return(Ok(response));
        }
Ejemplo n.º 2
0
        private async Task <ContributorsDto> InvokeCommandAsync(ICommand command)
        {
            var context = await CommandBus.PublishAsync(command);

            var result   = context.Result <IAppEntity>();
            var response = ContributorsDto.FromApp(result, appPlansProvider, this, false);

            return(response);
        }
Ejemplo n.º 3
0
        public IActionResult GetContributors(string app)
        {
            var response = Deferred.Response(() =>
            {
                return(ContributorsDto.FromApp(App, appPlansProvider, this, false));
            });

            Response.Headers[HeaderNames.ETag] = App.ToEtag();

            return(Ok(response));
        }
Ejemplo n.º 4
0
        public IActionResult GetContributors(string app)
        {
            var contributors = App.Contributors.Select(x => SimpleMapper.Map(x, new ContributorDto())).ToArray();

            var response = new ContributorsDto {
                Contributors = contributors, MaxContributors = appPlansProvider.GetPlanForApp(App).MaxContributors
            };

            Response.Headers["ETag"] = new StringValues(App.Version.ToString());

            return(Ok(response));
        }
Ejemplo n.º 5
0
        private async Task <ContributorsDto> InvokeCommandAsync(ICommand command)
        {
            var context = await CommandBus.PublishAsync(command);

            if (context.PlainResult is InvitedResult invited)
            {
                return(ContributorsDto.FromApp(invited.App, appPlansProvider, this, true));
            }
            else
            {
                return(ContributorsDto.FromApp(context.Result <IAppEntity>(), appPlansProvider, this, false));
            }
        }
Ejemplo n.º 6
0
        public IActionResult GetContributors(string app)
        {
            var contributors = App.Contributors.Select(x => new ContributorDto {
                ContributorId = x.Key, Permission = x.Value
            }).ToArray();

            var response = new ContributorsDto {
                Contributors = contributors, MaxContributors = appPlansProvider.GetPlanForApp(App).MaxContributors
            };

            Response.Headers["ETag"] = App.Version.ToString();

            return(Ok(response));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> PostContributor(string app, [FromBody] AssignContributorDto request)
        {
            var command = request.ToCommand();
            var context = await CommandBus.PublishAsync(command);

            var response = (ContributorsDto)null;

            if (context.PlainResult is IAppEntity newApp)
            {
                response = ContributorsDto.FromApp(newApp, appPlansProvider, this, false);
            }
            else if (context.PlainResult is InvitedResult invited)
            {
                response = ContributorsDto.FromApp(invited.App, appPlansProvider, this, true);
            }

            return(CreatedAtAction(nameof(GetContributors), new { app }, response));
        }
Ejemplo n.º 8
0
 private Task <ContributorsDto> GetResponseAsync(IAppEntity app, bool invited)
 {
     return(ContributorsDto.FromAppAsync(app, Resources, userResolver, appPlansProvider, invited));
 }