public ActionResult Save(string movieName, string Category)
 {
     if (ModelState.IsValid)
     {
         MoviesTabelHelper.InsertNewMovie(movieName, Category);
         return(RedirectToAction("Index"));
     }
     else
     {
         TempData["error"] = "You must fill in all the fields!!";
         return(View("New"));
     }
 }
예제 #2
0
        public ActionResult InsertNewRental(string name, string movie)
        {
            bool boolean = true;

            if (RentalTableHelper.CountingMovieDuplicates(name, movie) <= MoviesTabelHelper.CountingMovieDuplicates(name, movie))
            {
                RentalTableHelper.InsertNewRental(name, movie);

                if (RentalTableHelper.DoesMovieReturned(name, movie))
                {
                    ErrorMsg = "There seems to be a problem, the movie rental has not been made, try again";
                    boolean  = true;
                }
                else
                {
                    ErrorMsg = "Movie rental successful!";
                    boolean  = false;
                }
            }
            var ReqOfRent = new { strMsg = ErrorMsg, Isbool = boolean };

            return(Json(ReqOfRent));
        }
        public ActionResult Index()
        {
            List <Movies> list = MoviesTabelHelper.GetMoviesList();

            return(View(list));
        }