public ActionResult Edit(int id) { if (Session["Roles"] != null && Session["Roles"].Equals("Admin")) { hypster_tv_DAL.videoFeaturedManager featuredManager = new hypster_tv_DAL.videoFeaturedManager(); hypster_tv_DAL.videoFeaturedSlideshow slide = new hypster_tv_DAL.videoFeaturedSlideshow(); slide = featuredManager.getFeaturedVideoByID(id); ViewBag.ID = id; return(View(slide)); } else { return(RedirectPermanent("/home/")); } }
public ActionResult Delete(int id) { if (Session["Roles"] != null && Session["Roles"].Equals("Admin")) { hypster_tv_DAL.videoFeaturedManager featuredManager = new hypster_tv_DAL.videoFeaturedManager(); hypster_tv_DAL.videoFeaturedSlideshow slide = new hypster_tv_DAL.videoFeaturedSlideshow(); slide = featuredManager.getFeaturedVideoByID(id); if (slide.videoFeatured_ID != 0) { //remove image System.IO.FileInfo del_file = new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["videoSlideshowStorage_Path"] + "\\" + slide.ImageSrc); del_file.Delete(); featuredManager.DeleteFeaturedVideo(slide.videoFeatured_ID); } return(RedirectToAction("Index")); } else { return(RedirectPermanent("/home/")); } }