Example #1
0
        public async Task <IActionResult> Get(int id)
        {
            TheaterRepository repo = new TheaterRepository();
            var temp = await repo.GetTheaterById(id);

            return(Ok(temp));
        }
         public MovieController()
        {
            string cnn = ConfigurationManager.ConnectionStrings["CinemaCnn"].ToString();
            var dbContext = new DatabaseContext(cnn);

            var movieRepository = new MovieRepository(dbContext);
            var theaterRepository = new TheaterRepository(dbContext);
            var genreRepository = new GenreRepository(dbContext);
            var timeIntervalRepository = new TimeIntervalRepository(dbContext);
            var userRepository = new UserRepository(dbContext);
            var movieUserRepository = new MovieUserRepository(dbContext);
             _db = dbContext;
            

            _movieRepository = movieRepository;
            _genreRepository = genreRepository;
            _theaterRepository = theaterRepository;
            _timeIntervalRepository = timeIntervalRepository;
             _userRepository = userRepository;
             _movieUserRepository = movieUserRepository;

            _movieService = new MovieService(movieRepository, theaterRepository, 
                _genreRepository, timeIntervalRepository);
            _genreService = new GenreService(genreRepository);
            _theaterService = new TheaterService(theaterRepository);
            _movieUserService = new MovieUserService(movieUserRepository, movieRepository, userRepository);
        }
Example #3
0
        public async Task <IActionResult> Get()
        {
            TheaterRepository repo = new TheaterRepository();
            var temp = await repo.GetAllTheaters();

            return(Ok(temp));
        }
 public TheaterController()
 {
     string cnn = ConfigurationManager.ConnectionStrings["CinemaCnn"].ToString();
     var dbContext = new DatabaseContext(cnn);
     var theaterRepo = new TheaterRepository(dbContext);
     _theaterRepository = theaterRepo;
 }
Example #5
0
 public UnitOfWork(TheaterDbContext context)
 {
     _context = context;
     Addresses = new AddressRepository(_context);
     Orders = new OrderRepository(_context);
     Performances = new PerformanceRepository(_context);
     Questions = new QuestionRepository(_context);
     TheaterPerformances = new TheaterPerformanceRepository(_context);
     UserAnswers = new UserAnswerRepository(_context);
     Users = new UserRepository(_context);
     Variants = new VariantRepository(_context);
     Theaters = new TheaterRepository(_context);
 }
Example #6
0
        public async Task <Theater> GetAsync(string id)
        {
            var theater = await TheaterRepository.GetAsync(id);

            if (theater != null)
            {
                var locations = await LocationRepository.GetByTheaterId(theater.Id.ToString());

                if (locations.Any())
                {
                    theater.Locations = locations;
                }
            }

            return(theater);
        }
Example #7
0
        public async Task <List <Theater> > FindAllAsync()
        {
            var theates = await TheaterRepository.FindAllAsync();

            if (theates.Any())
            {
                foreach (var theater in theates)
                {
                    var locations = await LocationRepository.GetByTheaterId(theater.Id.ToString());

                    if (locations.Any())
                    {
                        theater.Locations = locations;
                    }
                }
            }

            return(theates);
        }
Example #8
0
 public TheaterService(TheaterRepository TheaterRepository, ShowTimeRepository showTimeRepository)
 {
     this.repository         = TheaterRepository;
     this.showTimeRepository = showTimeRepository;
 }
 public MoviesController(TheaterRepository repo)
 {
     _repo = repo;
 }
Example #10
0
 public async Task UpdateAsync(Theater theater)
 {
     await TheaterRepository.UpdateAsync(theater);
 }
Example #11
0
 public async Task Delete(string id)
 {
     await TheaterRepository.Delete(id);
 }
Example #12
0
 public async Task Create(Theater theater)
 {
     await TheaterRepository.Create(theater);
 }