public async Task <ActionResult <IdentityResourcePropertiesApiDto> > GetProperties(int id, int page = 1, int pageSize = 10) { var identityResourcePropertiesDto = await _identityResourceService.GetIdentityResourcePropertiesAsync(id, page, pageSize); var identityResourcePropertiesApiDto = identityResourcePropertiesDto.ToIdentityResourceApiModel <IdentityResourcePropertiesApiDto>(); return(Ok(identityResourcePropertiesApiDto)); }
public ActionResult <Pagelist <IdentityResourceProperty> > GetIdentityProperties([FromQuery] PageInputDto pageInput, int identityResourceId) { if (!ModelState.IsValid) { return(BadRequest(ModelStateErrors)); } var result = _identityResourceService.GetIdentityResourcePropertiesAsync(pageInput, identityResourceId); return(result); }
public async Task <IActionResult> IdentityResourceProperties(int id, int?page) { if (id == 0) { return(NotFound()); } var properties = await _identityResourceService.GetIdentityResourcePropertiesAsync(id, page ?? 1); return(View(properties)); }
private void SetupIdentityResources() { FieldAsync <IdentityResourceType>("IdentityResource", arguments: new QueryArguments( new QueryArgument <IntGraphType> { Name = "id" } ), resolve: async context => { if (context.HasArgument("id")) { var id = context.GetArgument <int>("id"); var identityResourceDto = await _identityResourceService.GetIdentityResourceAsync(id); var identityResourceApiModel = identityResourceDto.ToIdentityResourceApiModel <IdentityResourceApiDto>(); return(identityResourceApiModel); } return(new ArgumentNullException("id")); } ); FieldAsync <ListGraphType <IdentityResourceType> >("IdentityResources", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "search", DefaultValue = "" }, new QueryArgument <IntGraphType> { Name = "page", DefaultValue = 1 }, new QueryArgument <IntGraphType> { Name = "pageSize", DefaultValue = 10 } ), resolve: async context => { var searchText = context.GetArgument <string>("search"); var page = context.GetArgument <int>("page"); var pageSize = context.GetArgument <int>("pageSize"); var identityResourcesDto = await _identityResourceService.GetIdentityResourcesAsync(searchText, page, pageSize); var identityResourcesApiDto = identityResourcesDto.ToIdentityResourceApiModel <IdentityResourcesApiDto>(); return(identityResourcesApiDto.IdentityResources); } ); FieldAsync <IdentityResourceType>("IdentityResourceProperty", arguments: new QueryArguments( new QueryArgument <IntGraphType> { Name = "id" } ), resolve: async context => { if (context.HasArgument("id")) { var id = context.GetArgument <int>("id"); var identityResourcePropertiesDto = await _identityResourceService.GetIdentityResourcePropertyAsync(id); var identityResourcePropertyApiDto = identityResourcePropertiesDto.ToIdentityResourceApiModel <IdentityResourcePropertyApiDto>(); return(identityResourcePropertyApiDto); } return(new ArgumentNullException("id")); } ); FieldAsync <ListGraphType <IdentityResourceType> >("IdentityResourcesProperties", arguments: new QueryArguments( new QueryArgument <IntGraphType> { Name = "id" }, new QueryArgument <IntGraphType> { Name = "page", DefaultValue = 1 }, new QueryArgument <IntGraphType> { Name = "pageSize", DefaultValue = 10 } ), resolve: async context => { if (context.HasArgument("id")) { var id = context.GetArgument <int>("id"); var page = context.GetArgument <int>("page"); var pageSize = context.GetArgument <int>("pageSize"); var identityResourcePropertiesDto = await _identityResourceService.GetIdentityResourcePropertiesAsync(id, page, pageSize); var identityResourcePropertiesApiDto = identityResourcePropertiesDto.ToIdentityResourceApiModel <IdentityResourcePropertiesApiDto>(); return(identityResourcePropertiesApiDto.IdentityResourceProperties); } return(new ArgumentNullException("id")); } ); }