Esempio n. 1
0
        public int updateGallery()
        {
            renoRatorDBEntities db = new renoRatorDBEntities();
            Gallery g = db.Galleries.FirstOrDefault(gal => gal.galleryID == this.galleryID);
            if (g == null)
                g = new Gallery();
            int gid = g.galleryID;
            //g.photos = this.photos;
            g.name = this.name;
            if (gid == 0)
                db.AddToGalleries(g);
            db.SaveChanges();
            int newid = g.galleryID;

            foreach (Photo p in this.photos)
            {
                Photo photo = new Photo();
                photo.galleryID = newid;
                photo.path = p.path;
                photo.thumbPath = p.thumbPath;
                photo.description = p.description;
                db.AddToPhotos(photo);
                db.SaveChanges();
            }
            return newid;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Photos EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPhotos(Photo photo)
 {
     base.AddObject("Photos", photo);
 }
 /// <summary>
 /// Create a new Photo object.
 /// </summary>
 /// <param name="photoID">Initial value of the photoID property.</param>
 /// <param name="path">Initial value of the path property.</param>
 /// <param name="thumbPath">Initial value of the thumbPath property.</param>
 public static Photo CreatePhoto(global::System.Int32 photoID, global::System.String path, global::System.String thumbPath)
 {
     Photo photo = new Photo();
     photo.photoID = photoID;
     photo.path = path;
     photo.thumbPath = thumbPath;
     return photo;
 }