Пример #1
0
        public ActionResult RemoveShow()
        {
            ShowDal shows = new ShowDal();

            shows.GetAllShows();
            return(View(shows));
        }
Пример #2
0
        public ActionResult AddShow(int hallId, string MovieName, DateTime time = default)
        {
            if (hallId == 0 || MovieName == "0" || time == null)
            {
                string msg = "You need to fill the details of the new show";
                return(RedirectToAction("AddShow", "Admin", new { msg }));
            }

            if (time < DateTime.Now.AddDays(1))
            {
                string msg = "Adding show time need to be 24 Hour before show!!";
                return(RedirectToAction("AddShow", "Admin", new { msg }));
            }
            ShowDal sd = new ShowDal();

            sd.GetAllHallShow(hallId);
            foreach (Show s in sd.MyList)
            {
                Movie m = new Movie();
                m.GetMovieById(s.movie);

                if (Math.Abs(s.dateTime.Subtract(time).TotalMinutes) < m.MovieLength + 30)
                {
                    string msg = "Invalid Date Or Time";
                    return(RedirectToAction("AddShow", "Admin", new { msg }));
                }
            }
            Show show = new Show
            {
                hall     = hallId,
                movie    = Movie.GetIdByName(MovieName),
                dateTime = time
            };

            show.AddToDb();

            return(RedirectToAction("AdminHomePage", "Admin"));
        }
Пример #3
0
 public void UpdateShow(Contracts.Show showToUpdate)
 {
     ShowDal dal = new ShowDal();
     dal.UpdateEntity(showToUpdate);
 }
Пример #4
0
 int IShowsManager.CreateShow(Contracts.Show showToCreate)
 {
     ShowDal dal = new ShowDal();
     return dal.CreateEntity(showToCreate);
 }
Пример #5
0
 public Contracts.Show FindShow(int showID)
 {
     ShowDal dal = new ShowDal();
     return dal.GetEntity(showID);
 }
Пример #6
0
 public void DeleteShow(int showId)
 {
     ShowDal dal = new ShowDal();
     dal.DeleteEntity(showId);
 }
Пример #7
0
 public void CreateShow(Contracts.Show showToCreate)
 {
     ShowDal dal = new ShowDal();
     dal.CreateEntity(showToCreate);
 }
Пример #8
0
 public Contracts.Show[] FindShows(Contracts.ShowCriteria showCriteria)
 {
     ShowDal dal = new ShowDal();
     return dal.GetShowsByCriteria(showCriteria);
 }