public ActionResult Index()
        {
            var viewMovieQry = new MovieData();

            viewMovieQry.Movie = (from me in db.Movies select me).ToArray();
            viewMovieQry.MovieShowTime = (from mst in db.MovieShowTimes select mst).ToArray();

            return View(viewMovieQry);
        }
        // GET: /Movie/
        public ActionResult Index(int? id, int? MovieShowTimeID, string sortingOrder)
        {
            var viewMovieQry = new MovieData();

            if (id != null)
            {
                ViewBag.MovieDataID = id.Value;
                viewMovieQry.MovieShowTime = viewMovieQry.Movie.
                    Where(i => i.MovieID == id.Value).Single().MovieShowTimes;
            }

            if (MovieShowTimeID != null)
            {
                ViewBag.movieShowTimeID = MovieShowTimeID.Value;
                viewMovieQry.Movie = viewMovieQry.Movie.Where
                    (i => i.MovieID == viewMovieQry.MovieShowTime.Where
                        (d => d.MovieShowTimeID == MovieShowTimeID.Value).SingleOrDefault().MovieID);
            }

            if (!string.IsNullOrEmpty(sortingOrder))
            {
                switch (sortingOrder)
                {
                    case "MovieName":
                        viewMovieQry.Movie = viewMovieQry.Movie.OrderBy(x => x.MovieName).ToList();
                        break;
                    case "ReleaseDate":
                        viewMovieQry.Movie = viewMovieQry.Movie.OrderBy(x => x.ReleaseDate).ToList();
                        break;
                    case "Rate":
                        viewMovieQry.Movie = viewMovieQry.Movie.OrderByDescending(x => x.Rate).ToList();
                        break;
                    case "Director":
                        viewMovieQry.Movie = viewMovieQry.Movie.OrderBy(x => x.Director).ToList();
                        break;
                    default:
                        break;
                }
            }

            return View(viewMovieQry);
        }
        // GET: /MovieShowTime/
        public ActionResult Index(int? id, int? MovieShowTimeID)
        {
            var viewMovieQry = new MovieData();

            viewMovieQry.Movie = (from me in db.Movies
                                  orderby me.MovieID
                                  select me).ToArray();

            viewMovieQry.MovieShowTime = (from mst in db.MovieShowTimes
                                          orderby mst.ShowTime.Hour
                                          select mst).ToArray();

            //select * movieShowTime only movie by the ID
            if (id != null)
            {
                ViewBag.MovieDataID = id.Value;
                viewMovieQry.Movie = (from me in db.Movies
                                      where me.MovieID == id.Value
                                      select me);

                viewMovieQry.MovieShowTime = (from mst in db.MovieShowTimes
                                              where mst.MovieID == id.Value
                                              orderby mst.ShowTime
                                              select mst).ToArray();
            }

            // get spesific movieShowTime by his ID
            if (MovieShowTimeID != null)
            {
                ViewBag.movieShowTimeID = MovieShowTimeID.Value;
                viewMovieQry.MovieShowTime = (from me in db.MovieShowTimes
                                      where me.MovieShowTimeID == id.Value
                                      select me);
            }

            return View(viewMovieQry);
        }
        // GET: /Movie/Edit/5
        public ActionResult Edit(int? id)
        {
            if (TempData.ContainsKey("MovieID"))
            {
                TempData.Remove("MovieID");
            }
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            MovieData md = new MovieData(id);

            ViewData.Add("Genre", new SelectList(db.Genre.ToArray(), "GenreID", "EnglishName", md.Movie.Where(x => x.MovieID == id).Select(y => y.GenreID)));
            ViewData.Add("showTimeQry", md);

            Movie movie = db.Movies.Find(id);

            if (movie == null)
            {
                return HttpNotFound();
            }

            TempData.Add("MovieID", movie.MovieID);
            return View(movie);
        }
        // GET: /MovieShowTime/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var viewMovieQry = new MovieData();

            viewMovieQry.Movie = (from me in db.Movies
                                  where me.MovieID == id
                                  select me).ToArray();
            viewMovieQry.MovieShowTime = (from mst in db.MovieShowTimes
                                          where mst.MovieID == id
                                          select mst).ToArray();

            ViewBag.MovieName = viewMovieQry.Movie.Where(mov => mov.MovieID == id).Single().MovieName;
            // MovieShowTime movieshowtime = db.MovieShowTimes.Find(id);

            if (viewMovieQry.MovieShowTime == null)
            {
                return HttpNotFound();
            }
            return View(viewMovieQry);
        }