Example #1
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 });
        }
Example #2
0
 public ActionResult Create(int galleryID)
 {
     var model = new ImageCreate { GalleryID = galleryID };
     return View(model);
 }