コード例 #1
0
        public async Task <IActionResult> GetApiResourceAsync(string subject)
        {
            if (string.IsNullOrWhiteSpace(subject))
            {
                ModelState["subject.String"].Errors.Clear();
                ModelState.AddModelError("", Messages.SubjectRequired);
            }

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

            var result = await _service.GetAsync(subject);

            if (result.IsSuccess)
            {
                if (result.Result == null)
                {
                    return(NotFound());
                }

                var meta = await GetCoreMetaDataAsync();

                return(Ok(new ApiResourceDetailResource(result.Result, Url, meta)));
            }

            return(BadRequest(result.ToError()));
        }
コード例 #2
0
 public async Task GetApiResource()
 {
     IApiResourceService service = Startup.CreateCluster().GrainFactory.GetGrain <IApiResourceService>(1);
     var r = await service.GetAsync();
 }
コード例 #3
0
        public async Task <ActionResult <ApiResourceDTO> > GetApiResourceAsync(int id)
        {
            var result = await apiResourceService.GetAsync(id);

            return(Ok(result));
        }
コード例 #4
0
        public async Task <IActionResult> GetApiResources(int page = 1, int pageSize = 10)
        {
            var apiResources = await _apiResourceService.GetAsync(page, pageSize);

            return(Ok(apiResources));
        }