Ejemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            SlideService slideService = new SlideService();

            slideService.RemoveSlide(id);

            return Redirect(Request.UrlReferrer.AbsoluteUri);
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            SlideModel model = new SlideModel();

            SlideService slideService = new SlideService();
            model.Slides = slideService.GetSlides();

            return View(model);
        }
Ejemplo n.º 3
0
        public ActionResult Add(Slide slide)
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            if (slide != null)
            {
                if (!string.IsNullOrEmpty(slide.Title) &&
                    !string.IsNullOrEmpty(slide.Url) &&
                    !string.IsNullOrEmpty(slide.Image))
                {
                    SlideService slideService = new SlideService();
                    slideService.AddSlide(slide);
                }
            }

            return Redirect(Request.UrlReferrer.AbsoluteUri);
        }