public ActionResult AddGallery() { Gallery g = new Gallery(); g.GalleryID = 0; g.Title = ""; g.Description = ""; return View("BlankGallery", g); }
private void detach_Galleries(Gallery entity) { this.SendPropertyChanging(); entity.Page = null; }
private void attach_Galleries(Gallery entity) { this.SendPropertyChanging(); entity.Page = this; }
partial void DeleteGallery(Gallery instance);
partial void UpdateGallery(Gallery instance);
partial void InsertGallery(Gallery instance);
private void FolderToGallery(Gallery g, DirectoryInfo dir) { foreach(DirectoryInfo d in dir.GetDirectories()) { FolderToGallery(g, d); } foreach (FileInfo f in dir.GetFiles()) { if (f.Extension == ".jpg" || f.Extension == ".gif" || f.Extension == ".png") { AddImage(g, f); } } }
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(); }
public int SaveGallery( int GalleryID, int? pageid) { if (GalleryID != 0) //existing gallery { Gallery g = db.Galleries.FirstOrDefault(gl => gl.GalleryID == GalleryID); if (g != null) { TryUpdateModel(g); db.SubmitChanges(); } } else //new gallery { Gallery g = new Gallery(); TryUpdateModel(g); g.GalleryCategoryID = 0; db.Galleries.InsertOnSubmit(g); db.SubmitChanges(); GalleryID = g.GalleryID; } return GalleryID; }