public ActionResult AddImageToGallery(int galleryID, string imageSrc) { string src = imageSrc.Substring(imageSrc.IndexOf("/upload/")); FileInfo fi = new FileInfo(imageSrc); if (fi.Extension == ".jpg" || fi.Extension == ".gif" || fi.Extension == ".png") { GalleryImage gi = new GalleryImage(); gi.GalleryID = galleryID; gi.Src = src; gi.Position = db.GalleryImages.Count(i => i.GalleryID == galleryID); db.GalleryImages.InsertOnSubmit(gi); db.SubmitChanges(); return View("GalleryImage", gi); } return null; }
partial void DeleteGalleryImage(GalleryImage instance);
partial void UpdateGalleryImage(GalleryImage instance);
partial void InsertGalleryImage(GalleryImage instance);
private void detach_GalleryImages(GalleryImage entity) { this.SendPropertyChanging(); entity.Gallery = null; }
private void attach_GalleryImages(GalleryImage entity) { this.SendPropertyChanging(); entity.Gallery = this; }
private void AddImage(Gallery g, FileInfo f) { GalleryImage gi = new GalleryImage(); gi.Gallery = g; gi.Src = FileInfoToSrc(f); gi.Position = g.GalleryImages.Count(); db.GalleryImages.InsertOnSubmit(gi); db.SubmitChanges(); }