public ActionResult Create(GalleryImage galleryimage) { if (ModelState.IsValid) { db.Images.Add(galleryimage); db.SaveChanges(); return RedirectToAction("Index", "Images"); } return View(galleryimage); }
public ActionResult Edit(GalleryImage galleryimage) { if (ModelState.IsValid) { db.Entry(galleryimage).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(galleryimage); }
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(); }
public GalleryImage(GalleryImage rhs) { this.Commentary = rhs.Commentary; this.Title = rhs.Title; }
public ScaledImage(Thumbnail thumbNail, GalleryImage baseImage) { BaseImage = baseImage; Thumbnail = thumbNail; }