예제 #1
0
        private void MarcaMutations(IMarcaService marcaService)
        {
            FieldAsync <BooleanGraphType>(
                "create_marca",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <MarcaCreateType> > {
                Name = "create"
            }),
                resolve: async context =>
            {
                var marca = context.GetArgument <Marca>("create");
                return(await context.TryAsyncResolve(
                           async c => marcaService.Adiciona(marca)));
            });

            FieldAsync <BooleanGraphType>(
                "update_marca",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <MarcaUpdateType> > {
                Name = "update"
            }),
                resolve: async context =>
            {
                var marca = context.GetArgument <Marca>("update");
                return(await context.TryAsyncResolve(
                           async c => marcaService.Atualiza(marca)));
            });

            FieldAsync <BooleanGraphType>(
                "delete_marca",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <MarcaDeleteType> > {
                Name = "delete"
            }),
                resolve: async context =>
            {
                var marca = context.GetArgument <Marca>("delete");
                return(await context.TryAsyncResolve(
                           async c => marcaService.Deleta(marca)));
            });
        }