Esempio n. 1
0
        public SmartHomeMutation(SmartHomeData data)
        {
            Name = "Mutation";

            Field <LaptopType>(
                "updateLaptop",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <LaptopInputType> > {
                Name = "laptop"
            }
                    ),
                resolve: context =>
            {
                var laptop = context.GetArgument <Laptop>("laptop");

                return(data.UpdateLaptop(laptop));
            });

            Field <LightsType>(
                "updateLights",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <LightsInputType> > {
                Name = "lights"
            }
                    ),
                resolve: context =>
            {
                var lights = context.GetArgument <Lights>("lights");

                return(data.UpdateLights(lights));
            });
        }
Esempio n. 2
0
        public SmartHomeQuery(SmartHomeData data)
        {
            Name = "Query";

            Field <LaptopType>(
                "laptop",
                resolve: context => data.GetLaptop()
                );

            Field <LightsType>(
                "lights",
                resolve: context => data.GetLights()
                );
        }