Skip to content

Instantly share code, notes, and snippets.

@lssweatherhead
Created August 18, 2019 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lssweatherhead/4b46111a2732a6fbc870efc4421967f4 to your computer and use it in GitHub Desktop.
Save lssweatherhead/4b46111a2732a6fbc870efc4421967f4 to your computer and use it in GitHub Desktop.
public class CarbonFootprintCategoryGraphType : ObjectGraphType<ItemType>
{
public CarbonFootprintCategoryGraphType()
{
Name = "CarbonFootprintCategory";
Field<NonNullGraphType<IntGraphType>>(
"id",
resolve: context => context.Source.Id
);
Field<NonNullGraphType<StringGraphType>>(
"name",
resolve: context => context.Source.Name
);
Field<NonNullGraphType<ListGraphType<CarbonFootprintItemGraphType>>>(
"items",
resolve: context => ApplicationContext.Current.DatabaseContext.GetItemsByCategoryId(context.Source.Id)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment