Exemplo n.º 1
0
        public async Task <IActionResult> GetApps()
        {
            var subject = HttpContext.User.OpenIdSubject();

            var entities = await appProvider.GetUserApps(subject);

            var response = entities.Select(a => AppDto.FromApp(a, subject, appPlansProvider)).ToList();

            return(Ok(response));
        }
Exemplo n.º 2
0
        private Task <AppDto> InvokeCommandAsync(ICommand command)
        {
            return(InvokeCommandAsync(command, x =>
            {
                var userOrClientId = HttpContext.User.UserOrClientId() !;

                var isFrontend = HttpContext.User.IsInClient(DefaultClients.Frontend);

                return AppDto.FromApp(x, userOrClientId, isFrontend, appPlansProvider, Resources);
            }));
        }
Exemplo n.º 3
0
        private async Task <AppDto> InvokeCommandAsync(ICommand command)
        {
            var context = await CommandBus.PublishAsync(command);

            var userOrClientId = HttpContext.User.UserOrClientId() !;

            var result   = context.Result <IAppEntity>();
            var response = AppDto.FromApp(result, userOrClientId, appPlansProvider, Resources);

            return(response);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> PostApp([FromBody] CreateAppDto request)
        {
            var context = await CommandBus.PublishAsync(request.ToCommand());

            var userOrClientId  = HttpContext.User.UserOrClientId();
            var userPermissions = HttpContext.Permissions();

            var result   = context.Result <IAppEntity>();
            var response = AppDto.FromApp(result, userOrClientId, userPermissions, appPlansProvider, this);

            return(CreatedAtAction(nameof(GetApps), response));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> GetApps()
        {
            var userId          = HttpContext.User.OpenIdSubject();
            var userPermissions = HttpContext.User.Permissions();

            var entities = await appProvider.GetUserApps(userId, userPermissions);

            var response = entities.ToArray(a => AppDto.FromApp(a, userId, userPermissions, appPlansProvider));

            Response.Headers["ETag"] = response.ToManyEtag();

            return(Ok(response));
        }
Exemplo n.º 6
0
        public IActionResult GetApp(string app)
        {
            var response = Deferred.Response(() =>
            {
                var userOrClientId = HttpContext.User.UserOrClientId() !;

                return(AppDto.FromApp(App, userOrClientId, appPlansProvider, Resources));
            });

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

            return(Ok(response));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> GetApps()
        {
            var userOrClientId  = HttpContext.User.UserOrClientId();
            var userPermissions = HttpContext.Permissions();

            var apps = await appProvider.GetUserApps(userOrClientId, userPermissions);

            var response = apps.ToArray(a => AppDto.FromApp(a, userOrClientId, userPermissions, appPlansProvider, this));

            Response.Headers[HeaderNames.ETag] = response.ToManyEtag();

            return(Ok(response));
        }
Exemplo n.º 8
0
        public IActionResult GetApp(string app)
        {
            var response = Deferred.Response(() =>
            {
                var userOrClientId = HttpContext.User.UserOrClientId() !;

                var isFrontend = HttpContext.User.IsInClient(DefaultClients.Frontend);

                return(AppDto.FromApp(App, userOrClientId, isFrontend, Resources));
            });

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

            return(Ok(response));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> GetApps()
        {
            var userOrClientId  = HttpContext.User.UserOrClientId() !;
            var userPermissions = Resources.Permissions;

            var apps = await appProvider.GetUserAppsAsync(userOrClientId, userPermissions);

            var response = Deferred.Response(() =>
            {
                return(apps.OrderBy(x => x.Name).Select(a => AppDto.FromApp(a, userOrClientId, appPlansProvider, Resources)).ToArray());
            });

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

            return(Ok(response));
        }