public ActionResult BannerManagment() { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User")); } List <MainBanner> banners = new BannersHandler().GetAllBanners(); return(View(banners)); }
public ActionResult BannerDetails(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MainBanner banner = new BannersHandler().Getbanner(id); if (banner == null) { return(HttpNotFound()); } return(View(banner)); }
// GET: Home public ActionResult Index() { // Passing all banners from database to MAIN PAGE List <MainBanner> banners = new BannersHandler().GetAllBanners(); ViewBag.banners = banners; // Geting Products Summary from Database to Summary model to Index page ViewBag.indexProducts = ModelHelper.ToCameraSummaryList(new ProductHandler().GetLatestCameras(12)); return(View()); }
public ActionResult BannerEdit(int?id) { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MainBanner banner = new BannersHandler().Getbanner(id); if (banner == null) { return(HttpNotFound()); } return(View(banner)); }
public ActionResult BannerDeleteConfirmed(int id) { User u = (User)Session[WebUtil.CURRENT_USER]; if (!(u != null && u.IsInRole(WebUtil.ADMIN_ROLE))) { return(RedirectToAction("Login", "User")); } //Deleting IMAGE from both database and physical path MainBanner banner = new BannersHandler().Getbanner(id); string path = Request.MapPath(banner.Banner_Url); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); new BannersHandler().DeleteBanner(id); } return(RedirectToAction("BannerManagment")); }