Example #1
0
        public ActionResult CreateShow(ShowModel show)
        {
            if (show.Title == null || show.Seats <= 0 || show.Day == null)
            {
                TempData["error"] = "all fields are mandatory";

                return(View());
            }

            if (show.Seats > Constants.Rows * Constants.Seats)
            {
                TempData["error"] = "maximum number of seats is " + Constants.Rows * Constants.Seats;

                return(View());
            }

            if (showService.GetShowByDay(show.Day) != null)
            {
                TempData["error"] = "There is a show that day";

                return(View());
            }

            showService.CreateShow(show);

            return(RedirectToAction("Shows"));
        }