Example #1
0
 private static void UpdateRecord(int bookId)
 {
     using (var repo = new BooksRepo())
     {
         var bookToUpdate = repo.GetOne(bookId);
         if (bookToUpdate != null)
         {
             WriteLine("Before change: " + repo.Context.Entry(bookToUpdate).State);
             bookToUpdate.Genre = "bjhbvjhvj";
             WriteLine("After change: " + repo.Context.Entry(bookToUpdate).State);
             repo.Save(bookToUpdate);
             WriteLine("After Save: " + repo.Context.Entry(bookToUpdate).State);
         }
     }
 }