public void DelGalleryId(int GalleryId) { var gallery = db.Galleries.Where(x => x.Id.Equals(GalleryId)).FirstOrDefault(); PhotoDAO dao = new PhotoDAO(); dao.DelPhotos(gallery.Id); db.Galleries.Remove(gallery); db.SaveChanges(); }
public void DelGalleryCategoryId(int CategoryId) { var galleries = db.Galleries.Where(x => x.CategoryID.Equals(CategoryId)); foreach (var item in galleries) { PhotoDAO dao = new PhotoDAO(); dao.DelPhotos(item.Id); db.Galleries.Remove(item); } db.SaveChanges(); }