Example #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));
        }
Example #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());
        }
Example #3
0
 public ActionResult AuthorDelete(int id)
 {
     try
     {
         if (authorsDb.GetAuthorById(id) != null)
         {
             authorsDb.DeleteById(id);
             messagesAuthorTable = Resources.Resource.MessageDeleted;
         }
         else
         {
             messagesAuthorTable = Resources.Resource.ErrorFound;
         }
         return(RedirectToAction("AuthorsTable", "Admin"));
     }
     catch
     {
         messagesAuthorTable = Resources.Resource.Error;
         return(RedirectToAction("AuthorsTable", "Admin"));
     }
 }
Example #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());
        }
Example #5
0
 public Author GetAuthorById(int idAuthor)
 {
     return(_authorDao.GetAuthorById(idAuthor));
 }