Пример #1
0
        public ReviewType(ITitleService titleService)
        {
            Field(x => x.Id);
            Field(x => x.Score);
            Field(x => x.Text);
            Field(x => x.TitleId);
            Field(x => x.UserId);

            Field <TitleType>("title",
                              resolve: context => titleService.GetAsync(context.Source.TitleId));
        }
Пример #2
0
        private void AddTitleFields(ITitleService titleService)
        {
            Field <ListGraphType <TitleType> >("titles",
                                               arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "first", DefaultValue = 10
            }),
                                               resolve: context =>
            {
                int first = context.GetArgument <int>("first");
                return(titleService.ListAsync(first));
            });

            Field <TitleType>("title",
                              arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "id"
            }),
                              resolve: context =>
            {
                string id = context.GetArgument <string>("id");
                return(titleService.GetAsync(Guid.Parse(id).ToString()));
            });
        }
Пример #3
0
 public async Task <IActionResult> Get()
 {
     return(Ok(await _titleService.GetAsync()));
 }
Пример #4
0
        public async Task <Title> Get(Guid id)
        {
            var title = await _titleService.GetAsync(id);

            return(title);
        }