Пример #1
0
        public ActionResult Create(GalleryImage galleryimage)
        {
            if (ModelState.IsValid)
            {
                db.Images.Add(galleryimage);
                db.SaveChanges();
                return RedirectToAction("Index", "Images");
            }

            return View(galleryimage);
        }
Пример #2
0
 public ActionResult Edit(GalleryImage galleryimage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(galleryimage).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(galleryimage);
 }
Пример #3
0
        public void SetupThumbnails()
        {
            var db = new GalleryContext();

            //db.Thumbnails.Where(t => t.Description == "medium");

            var thumbs = from t in db.Thumbnails where t.MaxHeight == 600 select t;

            var tu = thumbs.First();

               // var tu = db.Thumbnails.();

            //Thumbnail tn = new Thumbnail();
            //tn.Description = "medium";
            //tn.MaxWidth = 600;
            //db.Thumbnails.Add(tn);
            //db.Thumbnails.SaveChanges();

            GalleryImage master = new GalleryImage();
            master.Filename = @"C:\Users\Ken\Documents\GitHub\SimplePhotoGallery\SimplePhotoGallery\Images\img_0519.jpg";
            db.Images.Add(master);

            var mediumThumb = new ScaledImage(tu, master);

            // this adds the medium thumb to the ProcessedImages collection
            mediumThumb.Process();

            // todo: add initialization code to ScaledImage to pass in BaseImage and Thumbnail
            //master.CreateThumbnail(tu, "medium");
            db.Images.Add(mediumThumb);

            db.SaveChanges();
        }
Пример #4
0
        public GalleryImage(GalleryImage rhs) 
        {
            this.Commentary = rhs.Commentary;
            this.Title = rhs.Title;

        }
Пример #5
0
 public ScaledImage(Thumbnail thumbNail, GalleryImage baseImage)
 {
     BaseImage = baseImage;
     Thumbnail = thumbNail;
 }
Пример #6
0
 public GalleryImage(GalleryImage rhs)
 {
     this.Commentary = rhs.Commentary;
     this.Title      = rhs.Title;
 }
Пример #7
0
 public ScaledImage(Thumbnail thumbNail, GalleryImage baseImage)
 {
     BaseImage = baseImage;
     Thumbnail = thumbNail;
 }