public RoomWallObjectQueries(IRoomWallObjectRepository repository) { FieldAsync <ListRoomWallObjectQueryModelType>( "search", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <PagedRequestType> > { Name = "pagination" }, new QueryArgument <NonNullGraphType <OrderedRequestType> > { Name = "ordering" }, new QueryArgument <RoomWallObjectFilteredRequestType> { Name = "filter", DefaultValue = new RoomWallObjectFilter() } ), resolve: async context => { var filtering = context.GetArgument <RoomWallObjectFilter>("filter"); var pagination = context.GetArgument <PagedRequest>("pagination"); var ordering = context.GetArgument <OrderedRequest>("ordering"); var(count, roomWallObjects) = await repository.SearchAsync(filtering, pagination, ordering); return(new ListResult <RoomWallObject> { TotalCount = count, Items = roomWallObjects }); } ); }
public RoomWallObjectMutation(IRoomWallObjectRepository repository, IRoomRepository roomRepository) { FieldAsync <RoomWallObjectQueryType>( "addWallObject", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <RoomWallObjectCreateViewModel> > { Name = "wallObject" }), resolve: async context => { var wallObject = context.GetArgument <RoomWallObject>("wallObject"); return(await context.TryAsyncResolve(async _ => await repository.AddWallObject(wallObject))); } ); }