public async Task <ActionResult <bool> > Remove(string resource)
        {
            var model = new RemoveApiResourceViewModel(resource);
            await _apiResourceAppService.Remove(model);

            return(ResponseDelete());
        }
示例#2
0
        public async Task <ActionResult <DefaultResponse <bool> > > Remove([FromBody] RemoveApiResourceViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(false));
            }
            await _apiResourceAppService.Remove(model);

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

            await _apiResourceAppService.Save(command);

            _database.ApiResources.FirstOrDefault(s => s.Name == command.Name).Should().NotBeNull();

            await _apiResourceAppService.Remove(new RemoveApiResourceViewModel(command.Name));

            _database.ApiResources.FirstOrDefault(s => s.Name == command.Name).Should().BeNull();
        }