Ejemplo n.º 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));
        }
Ejemplo n.º 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()));
            });
        }
Ejemplo n.º 3
0
 public async Task <IActionResult> Get()
 {
     return(Ok(await _titleService.GetAsync()));
 }
Ejemplo n.º 4
0
        public async Task <Title> Get(Guid id)
        {
            var title = await _titleService.GetAsync(id);

            return(title);
        }