Beispiel #1
0
        public ActionResult AddMovie(int movieID)
        {
            MovieBLL movieBLL = new MovieBLL();
            OrderBLL orderBLL = new OrderBLL();

            Cart  cart  = GetSessionCart();
            Movie movie = movieBLL.GetMovie(movieID);

            bool ownMovie = false; // False is user not logged in
            // Check if user is logged in
            Customer customer = (Customer)Session["customer"];

            if (customer != null)
            {
                ownMovie = orderBLL.OwnsMovie(customer, movie);
            }

            if (!InCart(movie, cart) || ownMovie)
            {
                CartItem item = new CartItem()
                {
                    Movie = movie,
                    Price = movie.Price
                };
                cart.CartItem.Add(item);
            }

            ViewBag.Total = GetTotal();
            return(PartialView("CartPartial", cart.CartItem.ToList()));
        }
Beispiel #2
0
        private void tvMovies_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.selPlay = this.tvMovies.SelectedNode?.Tag as Play;
            if (this.selPlay == null)
            {
                return;
            }
            MovieBLL mbll  = new MovieBLL();
            Movie    movie = mbll.GetMovie(this.selPlay.MovieId);

            if (this.selPlay != null)
            {
                this.lblMovieName.Text = movie.Name;
                this.lblType.Text      = movie.MovieTypeName;
                this.lblTime.Text      = (movie.Duration).ToString();
                this.picMovie.Image    = movie.Poster;
                this.lblPrice.Text     = "60";
                //换选电影时候先清空,再绑定,再把已售加上
                this.ClearAllPositions();
                this.GetAndBindPositions();
                this.ShowSoldPositonsByPlayId( );
            }
            else
            {
                this.lblMovieName.Text = "";
                this.lblType.Text      = "";
                this.lblTime.Text      = "";
                this.picMovie.Image    = null;
                this.lblPrice.Text     = "";
            }
        }
        // Dette viewet må gjøres om til enten en collapse eller en popup!!!
        public ActionResult Details(int movieID)
        {
            var   movieBLL = new MovieBLL();
            Movie movie    = movieBLL.GetMovie(movieID);

            //Gjør om til partial
            return(View(movie));
        }
        // Rediger Film
        public ActionResult EditMovie(int id)
        {
            var   movieBLL = new MovieBLL();
            Movie movie    = movieBLL.GetMovie(id);

            if (movie == null)
            {
                return(RedirectToAction("AllMovies"));               // Movie not found
            }
            MovieHelper movieHelper = new MovieHelper
            {
                movie        = movie,
                selectList   = movieBLL.GetCategories(),
                selectedList = movieBLL.SelectedCategoriesIDs(id)
            };

            return(View(movieHelper));
        }
        public Movie GetMovie(int movieID)
        {
            var movieBLL = new MovieBLL();

            return(movieBLL.GetMovie(movieID));
        }