Exemplo n.º 1
0
        public MovieService(IMovieEventService movieEventService)
        {
            this._movieEventService = movieEventService;
            _movies = new List <Movie>
            {
                new Movie
                {
                    Id          = 1,
                    Name        = "Forrest Gump",
                    ActorId     = 1,
                    Company     = "Paramount Pictures",
                    MovieRating = MovieRating.PG13,
                    ReleaseDate = new DateTime(1994, 7, 6)
                },

                new Movie
                {
                    Id          = 2,
                    Name        = "Se2en",
                    ActorId     = 2,
                    Company     = "New Line Cinema",
                    MovieRating = MovieRating.R,
                    ReleaseDate = new DateTime(1995, 9, 22)
                },

                new Movie
                {
                    Id          = 3,
                    Name        = "Top Gun",
                    ActorId     = 3,
                    Company     = "Paramount Pictures",
                    MovieRating = MovieRating.PG,
                    ReleaseDate = new DateTime(1986, 5, 16)
                },

                new Movie
                {
                    Id          = 4,
                    Name        = "La La Land",
                    ActorId     = 4,
                    Company     = "Summit Entertainment",
                    MovieRating = MovieRating.PG13,
                    ReleaseDate = new DateTime(2016, 12, 25)
                },

                new Movie
                {
                    Id          = 5,
                    Name        = "The Notebook",
                    ActorId     = 5,
                    Company     = "New Line Cinema",
                    MovieRating = MovieRating.PG13,
                    ReleaseDate = new DateTime(2004, 6, 25)
                },
            };
        }
Exemplo n.º 2
0
 public MovieService(IMovieEventService movieEventService)
 {
     #region Movies
     _movies = new List <Movie>
     {
         new Movie
         {
             Id          = 1,
             Name        = "Movie1",
             ActorID     = 1,
             Company     = "Company1",
             MovieRating = MovieRating.G,
             ReleaseDate = new DateTime(1994, 1, 1)
         },
         new Movie
         {
             Id          = 2,
             Name        = "Movie2",
             ActorID     = 2,
             Company     = "Company2",
             MovieRating = MovieRating.NC,
             ReleaseDate = new DateTime(1994, 1, 2)
         },
         new Movie
         {
             Id          = 3,
             Name        = "Movie3",
             ActorID     = 3,
             Company     = "Company3",
             MovieRating = MovieRating.PG,
             ReleaseDate = new DateTime(1994, 1, 3)
         },
         new Movie
         {
             Id          = 4,
             Name        = "Movie4",
             ActorID     = 4,
             Company     = "Company4",
             MovieRating = MovieRating.PG13,
             ReleaseDate = new DateTime(1994, 1, 4)
         },
         new Movie
         {
             Id          = 5,
             Name        = "Movie5",
             ActorID     = 5,
             Company     = "Company5",
             MovieRating = MovieRating.R,
             ReleaseDate = new DateTime(1994, 1, 5)
         },
     };
     this.movieEventService = movieEventService;
     #endregion
 }
Exemplo n.º 3
0
 public MovieService(IMovieEventService eventService)
 {
     _eventService = eventService;
     _movies       = new List <Movie>();
     for (int i = 1; i <= 5; i++)
     {
         _movies.Add(new Movie {
             Id = i, Name = Faker.Name.First(), ActorId = i, Company = Faker.Name.First(), MovieRating = Faker.Enum.Random <MovieRating>(), ReleaseDate = DateTimeOffset.Now.AddDays(Faker.RandomNumber.Next(0, 100) * -1)
         });
     }
 }
Exemplo n.º 4
0
 public MovieServices(IMovieEventService movieEventService)
 {
     _movieEventService = movieEventService;
     #region Movies
     _movies = new List <Movie>
     {
         new Movie {
             Id          = 1,
             Name        = "Forrest Gum",
             ActorId     = 1,
             Company     = "Paramount Pictures",
             MovieRating = MovieRating.PG13,
             ReleaseDate = new DateTime(1994, 7, 6)
         },
         new Movie {
             Id          = 2,
             Name        = "Se7en",
             ActorId     = 2,
             Company     = "New Line Cinema",
             MovieRating = MovieRating.R,
             ReleaseDate = new DateTime(1995, 9, 22)
         },
         new Movie {
             Id          = 3,
             Name        = "Top Gun",
             ActorId     = 3,
             Company     = "Paramount Pictures",
             MovieRating = MovieRating.PG,
             ReleaseDate = new DateTime(1986, 7, 6)
         },
         new Movie {
             Id          = 4,
             Name        = "Movie4",
             ActorId     = 4,
             Company     = "Paramount Pictures",
             MovieRating = MovieRating.PG13,
             ReleaseDate = new DateTime(1994, 7, 6)
         },
         new Movie {
             Id          = 5,
             Name        = "Movie5",
             ActorId     = 5,
             Company     = "Paramount Pictures",
             MovieRating = MovieRating.PG13,
             ReleaseDate = new DateTime(1994, 7, 6)
         },
     };
     #endregion
 }
Exemplo n.º 5
0
 public MoviesScription(IMovieEventService movieEventService)
 {
     _movieEventService = movieEventService;
     Name = "Subscription";
     AddField(new EventStreamFieldType {
         Name      = "movieEvent",
         Arguments = new QueryArguments(new QueryArgument <ListGraphType <MovieRatingEnum> >
         {
             Name = "movieRatings"
         }),
         Type       = typeof(MovieEventType),
         Resolver   = new FuncFieldResolver <MovieEvent>(ResolveEvent),
         Subscriber = new EventStreamResolver <MovieEvent>(Subscribe)
     });
 }
Exemplo n.º 6
0
        public MoviesSubscription(IMovieEventService movieEventService)
        {
            Name = "Subscription";
            this._movieEventService = movieEventService;

            base.AddField(new EventStreamFieldType
            {
                Name      = "movieEvent",
                Arguments = new QueryArguments(new QueryArgument <ListGraphType <MovieRatingEnum> >
                {
                    Name = "movieRating"
                }),
                Type       = typeof(MovieEventType),
                Resolver   = new FuncFieldResolver <MovieEvent>((context) => (context.Source as MovieEvent)),
                Subscriber = new EventStreamResolver <MovieEvent>(Subscribe)
            });
        }
Exemplo n.º 7
0
        public MoviesSubscription(IMovieEventService eventService)
        {
            _eventService = eventService;

            Name = nameof(MoviesSubscription);

            AddField(new global::GraphQL.Types.EventStreamFieldType
            {
                Name      = nameof(MovieEvent),
                Arguments = new global::GraphQL.Types.QueryArguments(new global::GraphQL.Types.QueryArgument <global::GraphQL.Types.ListGraphType <MovieRatingEnum> >
                {
                    Name = $"{nameof(MovieRating)}s"
                }),
                Type       = typeof(MovieEventType),
                Resolver   = new global::GraphQL.Resolvers.FuncFieldResolver <MovieEvent>(ResolveEvent),
                Subscriber = new global::GraphQL.Resolvers.EventStreamResolver <MovieEvent>(Subscripte)
            });
        }
Exemplo n.º 8
0
 public MovieService(IMovieEventService movieEventService)
 {
     this._movieEventService = movieEventService;
 }