コード例 #1
0
 public ActionResult Edit(int id)
 {
     IImageDAC dac = new ImageDAC();
     var image = dac.GetImage(id);
     var model = new ImageEdit { Filename = image.Filename, GalleryID = image.GalleryID, Title = image.Title, ImageID = image.ImageID };
     return View(model);
 }
コード例 #2
0
        public ActionResult Create(HttpPostedFileBase file, ImageCreate image)
        {
            if (file == null)
            {
                ModelState.AddModelError("Filename", "Please select an image");
            }
            else
            {
                image.Filename = file.FileName;
            }

            if (!ModelState.IsValid)
            {
                return(View(image));
            }

            string path = System.IO.Path.Combine(Server.MapPath("~/SiteContent/Images/Gallery/"), image.Filename);

            file.SaveAs(path);

            IImageDAC dac = new ImageDAC();

            dac.Add(image.Filename, image.Title, image.GalleryID, 1);
            return(RedirectToAction("Index", new { galleryID = image.GalleryID }));
        }
コード例 #3
0
        public ActionResult Delete(int id, int galleryID)
        {
            IImageDAC dac = new ImageDAC();

            dac.Delete(id);
            return(RedirectToAction("Index", new { galleryID = galleryID }));
        }
コード例 #4
0
 public ActionResult Edit(ImageEdit image)
 {
     if (!ModelState.IsValid)
         return View(image);
     IImageDAC dac = new ImageDAC();
     dac.Update(image.ImageID, image.Title, 1);
     return RedirectToAction("Index", new { galleryID = image.GalleryID });
 }
コード例 #5
0
 public ActionResult GalleryImages(int id)
 {
     IGalleryDAC dac = new GalleryDAC();
     Gallery gallery = dac.GetGallery(id);
     ViewBag.GalleryTitle = gallery.Name;
     IImageDAC imageDAC = new ImageDAC();
     var images = imageDAC.Get(id);
     return View(images);
 }
コード例 #6
0
        public ActionResult Edit(int id)
        {
            IImageDAC dac   = new ImageDAC();
            var       image = dac.GetImage(id);
            var       model = new ImageEdit {
                Filename = image.Filename, GalleryID = image.GalleryID, Title = image.Title, ImageID = image.ImageID
            };

            return(View(model));
        }
コード例 #7
0
 // GET: Admin666/Image
 public ActionResult Index(int galleryID)
 {
     IImageDAC dac = new ImageDAC();
     IGalleryDAC galleryDAC = new GalleryDAC();
     var gallery = galleryDAC.GetGallery(galleryID);
     ViewBag.Gallery = gallery.Name;
     ViewBag.GalleryID = gallery.GalleryID;
     ViewBag.DefaultImage = gallery.DisplayImage;
     var images = dac.Get(galleryID);
     return View(images);
 }
コード例 #8
0
        public ActionResult Edit(ImageEdit image)
        {
            if (!ModelState.IsValid)
            {
                return(View(image));
            }
            IImageDAC dac = new ImageDAC();

            dac.Update(image.ImageID, image.Title, 1);
            return(RedirectToAction("Index", new { galleryID = image.GalleryID }));
        }
コード例 #9
0
        public ActionResult GalleryImages(int id)
        {
            IGalleryDAC dac     = new GalleryDAC();
            Gallery     gallery = dac.GetGallery(id);

            ViewBag.GalleryTitle = gallery.Name;
            IImageDAC imageDAC = new ImageDAC();
            var       images   = imageDAC.Get(id);

            return(View(images));
        }
コード例 #10
0
        // GET: Admin666/Image
        public ActionResult Index(int galleryID)
        {
            IImageDAC   dac        = new ImageDAC();
            IGalleryDAC galleryDAC = new GalleryDAC();
            var         gallery    = galleryDAC.GetGallery(galleryID);

            ViewBag.Gallery      = gallery.Name;
            ViewBag.GalleryID    = gallery.GalleryID;
            ViewBag.DefaultImage = gallery.DisplayImage;
            var images = dac.Get(galleryID);

            return(View(images));
        }
コード例 #11
0
        public ActionResult Create(HttpPostedFileBase file, ImageCreate image)
        {
            if (file == null)
                ModelState.AddModelError("Filename", "Please select an image");
            else
                image.Filename = file.FileName;

            if (!ModelState.IsValid)
                return View(image);

            string path = System.IO.Path.Combine(Server.MapPath("~/SiteContent/Images/Gallery/"), image.Filename);
            file.SaveAs(path);

            IImageDAC dac = new ImageDAC();
            dac.Add(image.Filename, image.Title, image.GalleryID, 1);
            return RedirectToAction("Index", new { galleryID = image.GalleryID });
        }
コード例 #12
0
 public ActionResult Delete(int id, int galleryID)
 {
     IImageDAC dac = new ImageDAC();
     dac.Delete(id);
     return RedirectToAction("Index", new { galleryID = galleryID });
 }