예제 #1
0
        public async Task <IActionResult> GetApps()
        {
            var subject = User.OpenIdSubject();

            if (string.IsNullOrWhiteSpace(subject))
            {
                return(Ok(new List <AppDto>()));
            }

            var apps = await appStore.QueryAsync(subject, HttpContext.RequestAborted);

            var response = apps.Select(x => AppDto.FromDomainObject(x, subject)).ToArray();

            return(Ok(response));
        }
예제 #2
0
        public async Task <IActionResult> PostApp([FromBody] UpsertAppDto request)
        {
            var subject = UserId;

            if (string.IsNullOrWhiteSpace(subject))
            {
                return(Forbid());
            }

            var update = request.ToUpdate(subject);

            var app = await appStore.UpsertAsync(null, update, HttpContext.RequestAborted);

            var response = AppDto.FromDomainObject(app, UserId);

            return(Ok(response));
        }