Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        // 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());
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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"));
        }