Beispiel #1
0
        /// <summary>
        /// Gets all need information in ViewBag
        /// </summary>
        /// <param name="id">Date id</param>
        private void getViewBagForOrderPage(int id)
        {
            ViewBag.DateId = id;

            IOrderDao orders = OrdersTableConnection.Instance;

            IDateDao datesDb     = DatesTableConnection.Instance;
            DatePlay currentDate = datesDb.GetDateById(id);

            IPlayDao playsDb = PlaysTableConnection.Instance;
            Play     play    = playsDb.GetPlayById(currentDate.PlayId);

            ViewBag.Play = play;

            IGenreDao genresDb = GenresTableConnection.Instance;

            ViewBag.Genre = genresDb.GetGenreById(play.GenreId);

            IAuthorDao authorsDb = AuthorsTableConnection.Instance;

            ViewBag.Author = authorsDb.GetAuthorById(play.AuthorId);

            ViewBag.Dates = datesDb.GetDatesByIdPlay(play.Id).OrderBy(x => x.Date).ToList();

            ViewBag.TotalCountBalconySeats = TheaterInformation.TotalCountBalconySeats;
            ViewBag.PriceBalconySeats      = TheaterInformation.PriceBalcony;
            ViewBag.FreeBalconySeats       = (TheaterInformation.TotalCountBalconySeats -
                                              orders.GetCountBusySeetsByDateIdAndCategory(id, 0));

            ViewBag.TotalCountParterreSeats = TheaterInformation.TotalCountParterreSeats;
            ViewBag.PriceParterreSeats      = TheaterInformation.PriceParterre;
            ViewBag.FreeParterreSeats       = (TheaterInformation.TotalCountParterreSeats -
                                               orders.GetCountBusySeetsByDateIdAndCategory(id, 1));
        }
Beispiel #2
0
        // GET: Plays/Description
        public ActionResult Description(int id)
        {
            try
            {
                Play play = playsDb.GetPlayById(id);
                ViewBag.Play = play;

                ViewBag.Genre = genresDb.GetGenreById(play.GenreId);

                ViewBag.Author = authorsDb.GetAuthorById(play.AuthorId);

                ViewBag.Dates = datesDb.GetDatesByIdPlay(play.Id).OrderBy(x => x.Date).ToList();
            }
            catch (NullReferenceException)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }
Beispiel #3
0
 public ActionResult GenreDelete(int id)
 {
     try
     {
         if (genresDb.GetGenreById(id) != null)
         {
             genresDb.DeleteById(id);
             messagesGenreTable = Resources.Resource.MessageDeleted;
         }
         else
         {
             messagesGenreTable = Resources.Resource.ErrorFound;
         }
         return(RedirectToAction("GenresTable", "Admin"));
     }
     catch
     {
         messagesGenreTable = Resources.Resource.Error;
         return(RedirectToAction("GenresTable", "Admin"));
     }
 }
Beispiel #4
0
        // GET: Plays/Description
        public ActionResult Description(int id)
        {
            try
            {
                IPlayDao playsDb = PlaysTableConnection.Instance;
                Play     play    = playsDb.GetPlayById(id);
                ViewBag.Play = play;

                IGenreDao genresDb = GenresTableConnection.Instance;
                ViewBag.Genre = genresDb.GetGenreById(play.GenreId);

                IAuthorDao authorsDb = AuthorsTableConnection.Instance;
                ViewBag.Author = authorsDb.GetAuthorById(play.AuthorId);

                IDateDao datesDb = DatesTableConnection.Instance;
                ViewBag.Dates = datesDb.GetDatesByIdPlay(play.Id).OrderBy(x => x.Date).ToList();
            }
            catch (NullReferenceException)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }