public PlayerType(ISkaterStatisticRepository skaterStatisticRepository) { Field(x => x.Id); Field(x => x.Name, true); Field(x => x.BirthPlace); Field(x => x.Height); Field(x => x.WeightLbs); Field <StringGraphType>("birthDate", resolve: context => context.Source.BirthDate.ToShortDateString()); // Field<ListGraphType<SkaterStatisticType>>("skaterSeasonStats", // arguments: new QueryArguments(new QueryArgument<IntGraphType> { Name = "id" }), // resolve: context => skaterStatisticRepository.Get(context.Source.Id), description: "Player's skater stats"); Field <ListGraphType <SkaterStatisticType> >("skaterSeasonStats", arguments: new QueryArguments( new QueryArgument <IntGraphType> { Name = "limit" }, new QueryArgument <IntGraphType> { Name = "offset" }, new QueryArgument <BooleanGraphType> { Name = "sort" } ), resolve: context => { var limit = context.GetArgument <int?>("limit"); var offset = context.GetArgument <int?>("offset"); var sort = context.GetArgument <bool?>("sort"); return(skaterStatisticRepository.Get(context.Source.Id, limit, offset, sort)); } , description: "Player's skater stats"); }
public PlayerType(ISkaterStatisticRepository skaterStatisticRepository) { Field(x => x.Id); Field(x => x.Name, true); Field(x => x.BirthPlace); Field(x => x.Height); Field(x => x.WeightLbs); Field <StringGraphType>("birthDate", resolve: context => context.Source.BirthDate.ToShortDateString()); Field <ListGraphType <SkaterStatisticType> >("skaterSeasonStats", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => skaterStatisticRepository.Get(context.Source.Id), description: "Player's skater stats"); }
public PlayerType(ISkaterStatisticRepository skaterStatisticRepository) { Field(x => x.Id); Field(x => x.Name, true); Field(x => x.BirthPlace, true); Field(x => x.Height, true); Field(x => x.WeightLbs, true); // Field<StringGraphType>("birthDate", resolve: context => context.Source.BirthDate.ToString()); Field <StringGraphType>("birthDate", resolve: context => TimeZoneInfo.ConvertTimeFromUtc(context.Source.BirthDate, TimeZoneInfo.Local).ToString()); Field <ListGraphType <SkaterStatisticType> >("skaterSeasonStats", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => skaterStatisticRepository.Get(context.Source.Id), description: "Player's skater stats"); }