Exemple #1
0
        public async Task <ActionResult <HallMovie> > PostHallMovie(HallMovie hallMovie)
        {
            _context.hall_movie.Add(hallMovie);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHallMovie", new { id = hallMovie.hall_movieID }, hallMovie));
        }
Exemple #2
0
        public async Task <IActionResult> PutHallMovie(int id, HallMovie hallMovie)
        {
            if (id != hallMovie.hall_movieID)
            {
                return(BadRequest());
            }

            _context.Entry(hallMovie).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HallMovieExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #3
0
 public HomeController()
 {
     Movie movie = new Movie {
         Length = 122, ThreeD = true, Language = "Nederlands"
     };
     DateTime  datetime  = new DateTime(2017, 02, 22, 15, 2, 1);
     HallMovie hallmovie = new HallMovie {
         DateTime = datetime
     };
     //Order order = new Order(3, 5, 1, 0, movie, hallmovie);
     //decimal total = order.calcTotalPrice();
 }
        public ActionResult AddHallMovie(AddHallMovieModel AddHallMovieModel, DateTime begintime, DateTime endtime)
        {
            if (ModelState.IsValid)
            {
                AddHallMovieModel.AllHalls      = IHallRepository.GetAllHalls();
                AddHallMovieModel.AllMovies     = IMovieRepository.GetAllMovies().Where(m => m.RunTime > DateTime.Now);
                AddHallMovieModel.AllHallMovies = IHallMovieRepository.GetAllHallMovies();

                HallMovie HallMovie = new HallMovie()
                {
                    DateTime    = begintime,
                    DateTimeEnd = endtime,
                    Hall        = IHallRepository.GetOneHall(AddHallMovieModel.HallID),
                    Movie       = IMovieRepository.GetOneMovie(AddHallMovieModel.MovieID),
                    HallID      = AddHallMovieModel.HallID,
                    MovieID     = AddHallMovieModel.MovieID,
                    LadiesNight = false
                };

                if (HallMovie.DateTime < HallMovie.Movie.RunTime && HallMovie.DateTimeEnd < HallMovie.Movie.RunTime)
                {
                    if (HallMovie.DateTime > DateTime.Now && HallMovie.DateTimeEnd > DateTime.Now)
                    {
                        if (IHallMovieRepository.AddOneHallMovie(HallMovie) == HallMovie)
                        {
                            ViewBag.AddedHallmovie = "Voorstelling toegevoegd: " + IMovieRepository.GetOneMovie(AddHallMovieModel.MovieID).Title + " in zaal " + AddHallMovieModel.HallID + " op " + HallMovie.DateTime.ToShortDateString();
                            return(View("~/Views/Account/AccountViews/BackOfficeAccountOptions/AddHallMovie.cshtml", AddHallMovieModel));
                        }
                        else
                        {
                            HallMovie existing = IHallMovieRepository.AddOneHallMovie(HallMovie);
                            AddHallMovieModel.AllHallMovies = IHallMovieRepository.GetAllHallMovies();
                            ViewBag.ExistingHallmovie       = "Er is al een voorstelling in deze zaal op " + existing.DateTime.ToShortDateString() + ": " + existing.Movie.Title + " in zaal " + existing.HallID + " tussen " + existing.DateTime.ToShortTimeString() + " en " + existing.DateTimeEnd.ToShortTimeString();
                            return(View("~/Views/Account/AccountViews/BackOfficeAccountOptions/AddHallMovie.cshtml", AddHallMovieModel));
                        }
                    }
                    else
                    {
                        ViewBag.PlannedPast = "Het is niet mogelijk om een film in het verleden te plannen";
                        return(View("~/Views/Account/AccountViews/BackOfficeAccountOptions/AddHallMovie.cshtml", AddHallMovieModel));
                    }
                }
                else
                {
                    ViewBag.RunTimeEnded = "Film draait tot " + HallMovie.Movie.RunTime + " in de bioscoop, inplannen van " + HallMovie.DateTime + " tot " + HallMovie.DateTimeEnd + " gaat dus niet.";
                    return(View("~/Views/Account/AccountViews/BackOfficeAccountOptions/AddHallMovie.cshtml", AddHallMovieModel));
                }
            }
            else
            {
                return(View("~/Views/Account/AccountViews/BackOfficeAccountOptions/AddHallMovie.cshtml", AddHallMovieModel));
            }
        }
Exemple #5
0
        public HallMovie AddOneHallMovie(HallMovie Hallmovie)
        {
            IEnumerable <HallMovie> hallmovies = BioscoopModel.HallMovies.Where(hm => hm.DateTime <= Hallmovie.DateTimeEnd && hm.DateTimeEnd >= Hallmovie.DateTime && hm.HallID == Hallmovie.HallID).ToList();

            if (hallmovies.Count() != 0)
            {
                return(hallmovies.FirstOrDefault());
            }
            else
            {
                BioscoopModel.HallMovies.Add(Hallmovie);
                BioscoopModel.SaveChanges();
                return(Hallmovie);
            }
        }
Exemple #6
0
        public ActionResult Print(PrintViewModel PrintViewModel)
        {
            Order Order = OrderRepo.GetOrderOnPrintID(PrintViewModel.PrintID);

            List <Ticket> Tickets = TicketRepo.GetAllTicketsWithOrderID(Order.OrderID);

            HallMovie HallMovie = HallMovieRepo.GetOneHallMovie(Tickets.FirstOrDefault().HallMovieID);

            Movie Movie = MovieRepo.GetOneMovie(HallMovie.MovieID);

            HallMovieViewModel HallMovieViewModel = new HallMovieViewModel();

            HallMovieViewModel.order       = Order;
            HallMovieViewModel.TempTickets = Tickets;
            HallMovieViewModel.Movie       = Movie;
            HallMovieViewModel.HallMovie   = HallMovie;

            return(new ViewAsPdf("Order", HallMovieViewModel));
        }
Exemple #7
0
        public Discount(Order order, HallMovie hallmovie, Movie movie)
        {
            this.Order                   = order;
            this.Hallmovie               = hallmovie;
            this.Movie                   = movie;
            this.StudentDiscount         = 1.50m;
            this.ChildDiscount           = 1.50m;
            this.ElderlyDiscount         = 1.50m;
            this.PopcornArrangementPrice = 3.00m;

            if (movie.Length < 120)
            {
                this.StandardPrice = 8.50m;
            }
            else
            {
                this.StandardPrice = 9.00m;
            }
            if (movie.ThreeD == true)
            {
                this.StandardPrice += 2.50m;
            }
        }