Skip to content

Instantly share code, notes, and snippets.

@lssweatherhead
Created August 18, 2019 18:50
Show Gist options
  • Save lssweatherhead/2d3a3edb9f007e71dbdfa20b7f7d36a7 to your computer and use it in GitHub Desktop.
Save lssweatherhead/2d3a3edb9f007e71dbdfa20b7f7d36a7 to your computer and use it in GitHub Desktop.
public class CarbonFootprintVariantGraphType: ObjectGraphType<Variant>
{
public CarbonFootprintVariantGraphType()
{
Name = "CarbonFootprintItemVariant";
Field<NonNullGraphType<IntGraphType>>(
"id",
resolve: context => context.Source.Id
);
Field<NonNullGraphType<StringGraphType>>(
"name",
resolve: context => context.Source.VariantName
);
Field<NonNullGraphType<CarbonFootprintItemGraphType>>(
"item",
resolve: context => ApplicationContext.Current.DatabaseContext.GetItemById(context.Source.Item)
);
Field<NonNullGraphType<FloatGraphType>>(
"carbonDioxideEquivalentInGrams",
resolve: context => context.Source.CarbonDioxideEquivalent
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment