Esempio n. 1
0
        public async Task <ActionResult <DefaultResponse <bool> > > SaveScope([FromBody] SaveApiScopeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(false));
            }
            await _apiResourceAppService.SaveScope(model);

            return(Response(true));
        }
        public async Task <ActionResult <IEnumerable <Scope> > > SaveScope(string resource, [FromBody] SaveApiScopeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }

            model.ResourceName = resource;
            await _apiResourceAppService.SaveScope(model);

            var scopes = await _apiResourceAppService.GetScopes(resource);

            return(ResponsePost(nameof(Scopes), new { resource }, scopes));
        }
        public Task <bool> SaveScope(SaveApiScopeViewModel model)
        {
            var registerCommand = _mapper.Map <SaveApiScopeCommand>(model);

            return(Bus.SendCommand(registerCommand));
        }
Esempio n. 4
0
        public async Task <ActionResult <IEnumerable <ApiResourceScope> > > SaveScope(Guid resource, [FromBody] SaveApiScopeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ValidationProblemDetails(ModelState)));
            }
            var clients = await _apiResourceRepository.GetAsync(resource);


            clients.AddScope(model.Scope);
            await _apiResourceRepository.UpdateAsync(clients);

            var scopes = clients.FindScope(model.Scope);

            return(CreatedAtAction(nameof(Scopes), new { resource }, scopes));
        }