Пример #1
0
        public FieldQuery(IScoreCardRepository scoreCardRepository)
        {
            Field <ListGraphType <FieldType> >("fields",
                                               resolve: context => scoreCardRepository.GetFields());

            Field <FieldType>(
                "fieldById",
                arguments: new QueryArguments(
                    new QueryArgument <IdGraphType> {
                Name = "id"
            }
                    ),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(scoreCardRepository.GetFields().FirstOrDefault(x => x.Id == id));
            });
        }
Пример #2
0
 public ScoreController(IScoreCardRepository scoreRepository)
 {
     _scoreRepository = scoreRepository;
 }