public IActionResult GetContributors(string app) { var response = ContributorsDto.FromApp(App, appPlansProvider); Response.Headers["ETag"] = App.Version.ToString(); return(Ok(response)); }
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); }
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)); }
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)); } }
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)); }