public NobelPrizesType(INobelRepository nobelRepository) { Field <IntGraphType>("Id", resolve: context => context.Source.Id); Field <FloatGraphType>("Year", resolve: context => context.Source.Year); Field(x => x.Category); Field(x => x.Motivation); Field(x => x.City); Field(x => x.Country); Field <ListGraphType <NobelWinnersType> >("NobelWinners", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "Id" }), resolve: context => nobelRepository.GetWinnersById(context.Source.Id)); }
public NobelWinnersType(INobelRepository nobelRepository) { Field <IntGraphType>("Id", resolve: context => context.Source.Id); Field(x => x.Firstname); Field(x => x.Surname); Field(x => x.Born); Field <DateGraphType>("Year", resolve: context => context.Source.Died); Field(x => x.BornCity); Field(x => x.BornCountry); Field(x => x.BornCountryCode); Field(x => x.DiedCity); Field(x => x.DiedCountry); Field(x => x.DiedCountryCode); Field(x => x.Gender); Field <ListGraphType <NobelPrizesType> >("NobelPrizes", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "Id" }), resolve: context => nobelRepository.GetPricesById(context.Source.Id)); }
public NobelQuery(INobelRepository nobelRepository) { //Field<ListGraphType<NobelWinnersType>>( // "NobelWinners", // resolve: context => nobelRepository.GetAllWinners()); //Field<ListGraphType<NobelWinnersType>>( // "NobelWinnersById", // arguments: new QueryArguments(new QueryArgument<IntGraphType> { Name = "Id" }), // resolve: context => nobelRepository.GetWinnersById(context.GetArgument<int>("id"))); Field <ListGraphType <NobelWinnersType> >( "NobelWinners", arguments: new QueryArguments(new QueryArgument <StringGraphType> { Name = "Name" }), resolve: context => nobelRepository.GetWinners(context.GetArgument <string>("name"))); //Field<ListGraphType<NobelPrizesType>>( // "NobelPrices", // resolve: context => nobelRepository.GetAllPrices()); //Field<ListGraphType<NobelPrizesType>>( // "NobelPricesById", // arguments: new QueryArguments(new QueryArgument<IntGraphType> { Name = "Id" }), // resolve: context => nobelRepository.GetPricesById(context.GetArgument<int>("id"))); Field <ListGraphType <NobelPrizesType> >( "NobelPrices", arguments: new QueryArguments(new QueryArgument <StringGraphType> { Name = "Category" }, new QueryArgument <StringGraphType> { Name = "Year" }), resolve: context => nobelRepository.GetPrices(context.GetArgument <string>("category"), context.GetArgument <string>("year"))); }