public Expression <Func <TestSchema, Person> > AddPersonNames(TestSchema db, PeopleMutationsArgs args) { db.People.Add(new Person { Id = 11, Name = args.Names[0], LastName = args.Names[1] }); return(ctx => ctx.People.First(p => p.Id == 11)); }
public Expression <Func <TestSchema, Person> > AddPersonAdv(PeopleMutationsArgs args) { // test returning a constant in the expression which allows graphql selection over the schema (assuming the constant is a type in the schema) // Ie. in the mutation query you can select any valid fields in the schema from Person var person = new Person { Name = args.Name, Tasks = new List <Task> { new Task { Name = "A" } }, Projects = new List <Project> { new Project { Id = 123 } } }; return(ctx => person); }
public Person AddPersonInput(PeopleMutationsArgs args) { return(new Person { Name = args.NameInput.Name, LastName = args.NameInput.LastName }); }
public Person AddPerson(PeopleMutationsArgs args) { return(new Person { Name = string.IsNullOrEmpty(args.Name) ? "Default" : args.Name, Id = 555 }); }
public Person AddPersonNames(TestSchema db, PeopleMutationsArgs args) { return(new Person { Name = args.Names[0], LastName = args.Names[1] }); }