public ReservationController(IReservationRepo reservationRepo, ApplicationDbContext context, IScreeningRepo screeningRepo, IMovieRepo movieRepo, IHallRepo hallRepo) { this._reservationRepo = reservationRepo; this._context = context; this._movieRepo = movieRepo; this._hallRepo = hallRepo; this._screeningRepo = screeningRepo; }
public IMovieRepo GetMovieRepo() { if (_movieRepo == null) { _movieRepo = new MovieRepo(_dXContext); } return(_movieRepo); }
public override IResult RunTest(IMovieRepo repo) { QueryCnt = 1; Repo = repo; repo.Init(MovieList, Field); return(new CreateResult() { Repo = repo, Test = this }); }
public MovieController(IMovieRepo movieRepo, IGenericRepo <Genre> genreRepo, IMapper mapper, ILogger <MovieController> logger, IHubContext <RepoHub> hubContext) { this.movieRepo = movieRepo; this.genreRepo = genreRepo; this.mapper = mapper; this.logger = logger; this.hubContext = hubContext; }
private IResult ExecuteTest(IMovieRepo repo, ITest t) { IResult returnResult; Stopwatch sw = new Stopwatch(); sw.Start(); returnResult = t.RunTest(repo); sw.Stop(); returnResult.TestTime = sw.Elapsed; return(returnResult); }
public override IResult RunTest(IMovieRepo repo) { long?foundCnt = null; for (int i = 0; i < QueryCnt; i++) { foundCnt = repo.FindMoviesInGrossReceiptRange(MinGross, MaxGross); } return((IResult) new GrossRevResult() { FoundMovieCnt = foundCnt, Repo = repo, Test = this }); }
public override IResult RunTest(IMovieRepo repo) { long?foundCnt = null; for (int i = 0; i < QueryCnt; i++) { foundCnt = repo.FindMovies(StartYear, EndYear, Genre); } return(new YearGenreTestResult() { FoundMovieCnt = foundCnt, Repo = repo, Test = this }); }
private static void FetchMovie(string repositoryType) { IMovieRepo movieRepo = RepositoryFactory.GetMovieRepo(repositoryType); IEnumerable <Movie> movies = movieRepo.GetMovies(); foreach (var item in movies) { Console.WriteLine("Movie Name:- " + item.MovieName + "Director Name:- " + item.DirectorName + "Release Year:- " + item.ReleaseYear); } Console.WriteLine("-------------------------------------------------------------------"); }
public IMovieRepo getRepo(Repos repoEnum) { IMovieRepo repo = null; switch (repoEnum) { case Repos.OMDB: repo = new OmdbRepo(); break; default: repo = new OmdbRepo(); break; } return(repo); }
protected Task <bool> TaskImplementation(CancellationToken cancellationToken) { SqlConnection connection = new SqlConnection(ProjectVariables.dbConnectionString); try { connection.Open(); SqlCommand command = new SqlCommand(); command.Connection = connection; /* read id of the last movie which it's data refreshed */ int lastRefreshedId = DBFunctions.getLastRefreshedId(command); /* these movies will be refreshed from remote repository */ List <MovieClass> movieList = DBFunctions.getMovieTitles(command, lastRefreshedId); MovieRepoFactory repoFactory = MovieRepoFactory.getInstance(); IMovieRepo repo = repoFactory.getRepo(MovieRepoFactory.Repos.OMDB); int i = 0; for (i = 0; i < movieList.Count; i++) { MovieClass oldMovie = movieList[i]; MovieClass newMovie = repo.getMovie(oldMovie.t); newMovie.i = oldMovie.i; DBFunctions.updateMovie(command, newMovie); DBFunctions.updateLastRefreshedId(command, newMovie.i); } /* if all movies are refreshed, then start from the first one */ if (i == 0) { DBFunctions.updateLastRefreshedId(command, 0); } } catch (Exception ex) { Functions.LogWebMethodError(this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } return(Task.FromResult <bool>(true)); }
public static IMovieRepo GetMovieRepo(string repoType) { IMovieRepo movieRepo = null; switch (repoType) { case "Azure": movieRepo = new AzureRepo(); break; case "AWS": movieRepo = new AWSRepo(); break; case "SQL": movieRepo = new SQLRepo(); break; default: throw new ArgumentException("Invalid Repo Type"); } return(movieRepo); }
public abstract IResult RunTest(IMovieRepo repo);
public HomeController(IMovieRepo repo) { _movieRepo = repo; }
public MovieController(IMovieRepo movieRepo) { _movieRepo = movieRepo ?? throw new ArgumentNullException(nameof(movieRepo)); }
public JsonResult GetMovie(string userName, string password, string title) { GetMovieResult result = new GetMovieResult(); SqlConnection connection = new SqlConnection(ProjectVariables.dbConnectionString); try { Functions.EnsureNotNullCredentials(userName, password); connection.Open(); SqlCommand command = new SqlCommand(); command.Connection = connection; bool flag = DBFunctions.checkLogin(command, userName, password); if (!flag) { result.isErr = true; } else { // get movie from cache if it is cached MovieClass cacheMovie = null; MovieClass movie = null; if (Functions.getCache <MovieClass>(cache, ProjectVariables.MOVIE_CACHE_TAG, out cacheMovie)) { if (cacheMovie.t.Contains(title)) { movie = cacheMovie; } } // read movie from database if (movie == null) { movie = DBFunctions.getMovie(command, title); } // get the movie from remote repositories if (movie == null) { MovieRepoFactory repoFactory = MovieRepoFactory.getInstance(); IMovieRepo repo = repoFactory.getRepo(MovieRepoFactory.Repos.OMDB); movie = repo.getMovie(title); if (movie != null) { DBFunctions.insertMovie(command, movie); } } // add to cache if (movie != null) { Functions.setCache <MovieClass>(cache, ProjectVariables.MOVIE_CACHE_TAG, movie); } result.m = movie; } connection.Close(); } catch (Exception ex) { result.isErr = true; Functions.LogWebMethodError(this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } return(Json(result)); }
public MovieService(IAppLogger <MovieService> logger, IMovieRepo movieRepository) { _movieRepository = movieRepository; _logger = logger; }
public SearchResultController(IMovieRepo movieRepo) { this.movieRepo = movieRepo; }
public MoviesController(IMovieRepo repository, IMapper mapper) { _repository = repository; _mapper = mapper; }
public MovieController(IMovieRepo movieRepo, IActorRepo actorRepo) { _movieRepo = movieRepo; _actorRepo = actorRepo; }
// (dependency injection, based on Startup.ConfigureServices) public CastController(IMovieRepo repo) { Repo = repo; }
public ScreeningMoviesVM(IMovieRepo movieRepo, IHallRepo hallRepo, Screening screening) { this.Screening = screening; this.Movie = new SelectList(movieRepo.GetMoviesAsync().Result, "Id", "Title", screening.Movie_Id); this.Hall = new SelectList(hallRepo.GetHallsAsync().Result, "Id", "Name", screening.Hall_Id); }
public MovieController(IMovieRepo movieRepo, ApplicationDbContext context) { this._movieRepo = movieRepo; this._context = context; }
public MovieController(IMovieRepo movieRepo, IMessagePublisher messagePublisher) { _movieRepo = movieRepo; _messagePublisher = messagePublisher; }
public HomeController(IMovieRepo movieRepo) { this.movieRepo = movieRepo; }
// the parameters of this constructor will be injected automatically // based on what is set up in Startup.ConfigureServices. public MoviesController(IMovieRepo repo) { Repo = repo; }
public ScreeningRepo(ApplicationDbContext context, IHallRepo hallRepo, IMovieRepo movieRepo) { this._context = context; }
public HomeController(ILogger <HomeController> logger, IMovieRepo repo, MovieContext con) { _logger = logger; _repo = repo; _con = con; }
public MovieApiController(IMovieRepo repo) { _movieRepo = repo; }
public MovieService(IUnitOfWork unitOfWork) { _movieRepo = unitOfWork.GetMovieRepo(); _unitOfWork = unitOfWork; _movieActorRepo = unitOfWork.GetMovieActorRepo(); }
public MovieController(IMovieRepo repository) { _repository = repository; }