예제 #1
0
        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();
            
        }
예제 #2
0
        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();
        }