コード例 #1
0
        public async Task <IActionResult> ApiResourceDelete(ApiResourceDto apiResource)
        {
            await _apiResourceService.DeleteApiResourceAsync(apiResource);


            return(Success(nameof(ApiResources)));
        }
コード例 #2
0
        public async Task <IActionResult> ApiResourceDelete(ApiResourceDto apiResource)
        {
            await _apiResourceService.DeleteApiResourceAsync(apiResource);

            SuccessNotification(_localizer["SuccessDeleteApiResource"], _localizer["SuccessTitle"]);

            return(RedirectToAction(nameof(ApiResources)));
        }
コード例 #3
0
        public async Task <IActionResult> Delete(int id)
        {
            var apiResourceDto = new ApiResourceDto {
                Id = id
            };

            await _apiResourceService.GetApiResourceAsync(apiResourceDto.Id);

            await _apiResourceService.DeleteApiResourceAsync(apiResourceDto);

            return(Ok());
        }
コード例 #4
0
        public async Task <IActionResult> DeleteApiResourceAsync(int id)
        {
            var result = await apiResourceService.DeleteApiResourceAsync(id).ConfigureAwait(false);

            if (result.Succeeded)
            {
                return(Ok());
            }

            ModelState.AddModelError(string.Empty, result.ErrorMessage);
            return(BadRequest(ModelState));
        }
コード例 #5
0
        public async Task <IActionResult> Delete(ApiResourceModel model)
        {
            if (model.Id == 0)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var result = await _apiResourceService.DeleteApiResourceAsync(CommonMappers.Mapper.Map <ApiResource>(model));

            if (result)
            {
                SuccessNotification(await _localizationService.GetResourceAsync("ApiResource.Deleted"));
            }

            return(RedirectToAction(nameof(Index)));
        }