示例#1
0
        public JediQuery(JediService service)
        {
            Field <JediType>(
                "jedi", "Get one droid by id",
                arguments: new QueryArguments()
            {
                new QueryArgument <IntGraphType> {
                    Name        = "id",
                    Description = "Command to list jedis"
                }
            },
                resolve: context => {
                var userConterxt = context.UserContext as JediUserContext;
                var id           = context.GetArgument <int>("id");

                return(service.Get(id));
            }
                );

            Field <ListGraphType <JediType> >(
                "jedis", "Get lists jedi by param",
                arguments: new QueryArguments()
            {
                new QueryArgument <ListInputType> {
                    Name         = "param",
                    DefaultValue = new FindJediCmd(),
                    Description  = "Command to list jedis"
                },
                new QueryArgument <ListGraphType <IntGraphType> > {
                    Name        = "id",
                    Description = "Command to list jedis"
                },
                new QueryArgument <StringGraphType> {
                    Name        = "keyworks",
                    Description = "Command to list jedis"
                }
            },
                resolve: context => {
                var userConterxt = context.UserContext as JediUserContext;
                var param        = context.GetArgument <FindJediCmd>("param");
                var keyworks     = context.GetArgument <string>("keyworks");
                var jedi         = context.GetArgument <int[]>("id");

                param.Keyworks = keyworks ?? param.Keyworks;
                param.Jedi     = jedi ?? param.Jedi;

                return(service.Find(param));
            }
                );
        }
示例#2
0
        public JediMutation(JediService service)
        {
            Field <JediType>(
                "createJedi", "Get one droid by id",
                arguments: new QueryArguments()
            {
                new QueryArgument <CreateInputType> {
                    Name         = "command",
                    Description  = "Command to list jedis",
                    DefaultValue = new CreateJediCmd(),
                }
            },
                resolve: context => {
                var userConterxt = context.UserContext as JediUserContext;
                var command      = context.GetArgument <CreateJediCmd>("command");

                return(service.Create(command));
            }
                );

            Field <JediType>(
                "updateJedi", "Get one droid by id",
                arguments: new QueryArguments()
            {
                new QueryArgument <UpdateInputType> {
                    Name         = "command",
                    Description  = "Command to list jedis",
                    DefaultValue = new UpdateJediCmd(),
                }
            },
                resolve: context => {
                var userConterxt = context.UserContext as JediUserContext;
                var command      = context.GetArgument <UpdateJediCmd>("command");

                return(service.Update(command));
            }
                );
        }