public ActionResult AddMovieAction(string title, string genre, string releaseDate, string description, HttpPostedFileBase fileToUpload) { if (Session["uType"] == null)//user not logged in { return(RedirectToAction("Login")); } else { if (Session["uType"].ToString() == "A")//admin { string pic = null; if (fileToUpload != null) { //change this accordingly with the entered movieID //string pic = System.IO.Path.GetFileName(fileToUpload.FileName); pic = title + ".jpg"; string path = System.IO.Path.Combine(Server.MapPath("~/Content/Images/"), pic); fileToUpload.SaveAs(path); pic = "\\Content\\Images\\" + pic; } int ret = CRUDmovie.AddMovieFunc(title, description, genre, releaseDate, pic); if (ret == 1)//successfully added movie { return(RedirectToAction("Index")); } else if (ret == -1)//DB connection failed { return(RedirectToAction("Error", new { param = -1 })); } else//add movie failed { return(RedirectToAction("Error", new { param = 13 })); } } else//user not admin { return(RedirectToAction("Index")); } } }