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