public async Task <ActionResult <bool> > Update(string resource, [FromBody] ApiResource model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }

            await _apiResourceAppService.Update(resource, model);

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

            return(Response(true));
        }
        public async Task ShouldUpdateApi()
        {
            var command = ApiResourceFaker.GenerateApiResource().Generate();

            await _apiResourceAppService.Save(command);

            var client = _database.ApiResources.FirstOrDefault(s => s.Name == command.Name);

            client.Should().NotBeNull();

            InMemoryData.DetachAll();

            var updateCommand = ApiResourceFaker.GenerateApiResource().Generate();
            await _apiResourceAppService.Update(command.Name, updateCommand);

            _database.ApiResources.FirstOrDefault(f => f.Name == updateCommand.Name).Should().NotBeNull();
        }