public StarWarsMutation(StarWarsData data)
        {
            Name = "Mutation";

            Field <HumanType>(
                "createHuman",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <HumanInputType> > {
                Name = "human"
            }
                    ),
                resolve: context =>
            {
                var human = context.GetArgument <Human>("human");
                return(data.AddHuman(human));
            });

            Field <HumanType>(
                "deleteHuman",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "id", Description = "id of the human"
            }
                    ),
                resolve: context =>
            {
                var human = new Human()
                {
                    Id = Guid.NewGuid().ToString()
                };
                return(human);
            });
            Field <HumanType>(
                "updateHuman",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <HumanInputType> > {
                Name = "human"
            }
                    ),
                resolve: context =>
            {
                var human = context.GetArgument <Human>("human");
                return(data.AddHuman(human));
            });
        }
Exemplo n.º 2
0
        public StarWarsMutation(StarWarsData data)
        {
            Name = "Mutation";

            Field <HumanType>(
                "createHuman",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <HumanInputType> > {
                Name = "human"
            }
                    ),
                resolve: context =>
            {
                var human = context.GetArgument <Human>("human");
                return(data.AddHuman(human));
            });
        }
Exemplo n.º 3
0
        public StarWarsMutation(StarWarsData data)
        {
            Name = "Mutation";

            Field <HumanType>(
                "landingNavigation",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <LandingNavigationInputType> > {
                Name = "human"
            }
                    ),
                resolve: context =>
            {
                var human = context.GetArgument <Human>("human");
                Console.WriteLine("Data-1: " + human);
                return(data.AddHuman(human));
            });
        }
Exemplo n.º 4
0
        public StarWarsMutation(StarWarsData data)
        {
            Name = "Mutation";

            Field <HumanType>(
                "createHuman",
                arguments: new QueryArguments(
                    new QueryArgument <HumanInputType> {
                Name = "human111"
            }
                    ),
                resolve: context =>
            {
                var human = context.GetArgument <Human>("human111");

                human = human ?? new Human
                {
                    Id   = Guid.NewGuid().ToString(),
                    Name = "User" + Guid.NewGuid()
                };

                return(data.AddHuman(human));
            });
        }