public PropertyMutation(IMicroregiaoExternalService service) { Field <MicroregiaoType>( "addMicroregia", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <MicroregiaoInputType> > { Name = "microregiao" }), resolve: context => { var entity = context.GetArgument <Microregiao>("microregiao"); return(service.AddAsync(entity)); }); }
public MicroregiaoQuery(IMicroregiaoExternalService service) { Field <ListGraphType <MicroregiaoType> >( "microregiao", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => { var id = context.GetArgument <int?>("id"); return(id != null ? service.GetById(id.Value) : service.GetAllAsync()); }); }