예제 #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();
        }
예제 #3
0
        public void AddGallery(string Category, string Name, string Folder, IEnumerable<HttpPostedFileBase> uploads)
        {
            CategoryGalleryDAO categoryDAO = new CategoryGalleryDAO();
            var cath = categoryDAO.GetCategoryName(Category);
            Gallery newGallery = new Gallery()
            {
                Name = Name,
                CategoryID = cath.Id,
                Folder = Folder
            };
            db.Galleries.Add(newGallery);
            db.SaveChanges();

            PhotoDAO photoDAO = new PhotoDAO();
            photoDAO.AddPhoto(newGallery, uploads);
            
        }