예제 #1
0
 // updates an item from the database's table "Studios" by given object from the class Studio
 // if item with the object's id exists
 public void Update(Studio studio)
 {
     using (studioContext = new MovieStudioContext())
     {
         var item = studioContext.Studios.Find(studio.Id);
         if (item != null)
         {
             studioContext.Entry(item).CurrentValues.SetValues(studio);
             studioContext.SaveChanges();
         }
     }
 }
예제 #2
0
 // updates an item from the database's table "Movies" by given object from the class Movie
 // if item with the object's id exists
 public void Update(Movie movie)
 {
     using (movieContext = new MovieStudioContext())
     {
         var item = movieContext.Movies.Find(movie.Id);
         if (item != null)
         {
             movieContext.Entry(item).CurrentValues.SetValues(movie);
             movieContext.SaveChanges();
         }
     }
 }