public async Task <ActionResult <IdentityResourcePropertyApiDto> > GetProperty(int propertyId) { var identityResourcePropertiesDto = await _identityResourceService.GetIdentityResourcePropertyAsync(propertyId); var identityResourcePropertyApiDto = identityResourcePropertiesDto.ToIdentityResourceApiModel <IdentityResourcePropertyApiDto>(); return(Ok(identityResourcePropertyApiDto)); }
public async Task <IActionResult> IdentityResourcePropertyDelete(int id) { if (id == 0) { return(NotFound()); } var identityResourceProperty = await _identityResourceService.GetIdentityResourcePropertyAsync(id); return(View(nameof(IdentityResourcePropertyDelete), identityResourceProperty)); }
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")); } ); }