示例#1
0
 public IActionResult AddShow(MovieInfo movie)
 {
     if (ModelState.IsValid)
     {
         try
         {
             int admin = Convert.ToInt32(HttpContext.Session.GetInt32("Admin"));
             if (admin == 1)
             {
                 adminDAObj.AddShow(movie);
                 string success = "Movie added successfully";
                 return(View("AddOrRemove", new { message = success }));
             }
             else
             {
                 return(RedirectToAction("Home", "Movie"));
             }
         }
         catch (Exception exAddShow)
         {
             string exMessage = "oops! There is a problem in adding the movie.";
             return(RedirectToAction("Index", "ExeptionHandler", new { Exeption = exMessage }));
         }
     }
     else
     {
         return(View());
     }
 }