コード例 #1
0
        public async Task <IActionResult> DeleteApiResourceAsync(string subject)
        {
            var meta = await GetCoreMetaDataAsync();

            if (!meta.SupportsDelete)
            {
                return(MethodNotAllowed());
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                ModelState["subject.String"].Errors.Clear();
                ModelState.AddModelError("", Messages.SubjectRequired);
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.ToError()));
            }

            var result = await _service.DeleteAsync(subject);

            if (result.IsSuccess)
            {
                return(NoContent());
            }

            return(BadRequest(result.ToError()));
        }
コード例 #2
0
 public async Task <AjaxResult> DeleteAsync(Guid id)
 {
     return((await _apiResourceService.DeleteAsync(id)).ToAjaxResult());
 }
コード例 #3
0
        public async Task <ActionResult> RemoveApiResourceAsync(int id)
        {
            await apiResourceService.DeleteAsync(id);

            return(Ok());
        }