コード例 #1
0
        public MoviesMutation(IMovieStore moviesStore)
        {
            Name = "Mutation";

            Field <MovieType, Movie>()
            .Name("createMovie")
            .Argument <NonNullGraphType <MovieCreateInputType> >("movie", null)
            .ResolveAsync(async ctx =>
            {
                var movieInput = ctx.GetArgument <Movie>("movie");

                return(await moviesStore.CreateAsync(movieInput));
            });
        }
コード例 #2
0
        public DirectorType(IMovieStore movieStore, IDataLoaderContextAccessor accessor)
        {
            Field(x => x.Id);
            Field(x => x.Name);
            Field(x => x.BirthDate);

            Field <ListGraphType <MovieType> >()
            .Name("movies")
            .ResolveAsync(async ctx =>
            {
                var loader = accessor.Context.GetOrAddBatchLoader <int, IEnumerable <Movie> >(
                    "GetMoviesDirectedByAsync",
                    movieStore.GetMoviesDirectedByAsync
                    );

                return(await loader.LoadAsync(ctx.Source.Id));
            });
        }
コード例 #3
0
        public MoviesQuery(IMovieStore movieStore)
        {
            Name = "Query";

            Field <ListGraphType <MovieType> >()
            .Name("movies")
            .ResolveAsync(async ctx =>
            {
                return(await movieStore.GetMoviesAsync());
            });

            Field <MovieType>()
            .Name("movie")
            .Argument <IntGraphType, int>("id", null)
            .ResolveAsync(async ctx =>
            {
                return(await movieStore.GetMovieByIdAsync(ctx.GetArgument <int>("id")));
            });
        }
コード例 #4
0
 public MovieController()
 {
     _movieStore = new InMemoryMovieStore();
 }
コード例 #5
0
 public MovieService(IMovieStore movieStore)
 {
     _movieStore = movieStore ?? throw new ArgumentNullException(nameof(movieStore));
 }
コード例 #6
0
 public HomeController(IMovieStore movieStore)
 {
     _movieStore = movieStore;
 }
コード例 #7
0
 public MovieService()
 {
     MovieStore = StoreFactory.GetMovieStore();
 }
コード例 #8
0
 public MovieService(FilmingLocationService filmingLocationService, ISearchService searchService, IMovieStore movieStore)
 {
     this.filmingLocationService = filmingLocationService;
     this.searchService          = searchService;
     this.movieStore             = movieStore;
 }
コード例 #9
0
 public MoviesController(IMovieStore store, MovieList list)
 {
     _store = store;
 }
コード例 #10
0
 public MoviesController(IMovieStore store)
 {
     _store = store;
 }
コード例 #11
0
		public MoviesController(IMovieStore store)
		{
			_store = store;
		}
コード例 #12
0
ファイル: MoviesController.cs プロジェクト: ka2ya/ass3_api
 public MoviesController()
 {
     _store         = new DatastoreMovieStore("assig1hao");
     _imageUploader = new ImageUploader("book_hao");
 }