Venciity

Untitled

Mar 16th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. var db = new NewsDbContext();
  2.             Console.WriteLine("Application started.");
  3.             var firstNew = db.News.First();
  4.             var firstNewContent = firstNew.Content;
  5.             Console.Write("Text from DB: {0}. Enter the corrected text: ", firstNew.Content);
  6.             string input = Console.ReadLine();
  7.  
  8.             if (firstNewContent == db.News.First().Content)
  9.             {
  10.                 firstNew.Content = input;
  11.                 db.SaveChanges();
  12.                 Console.WriteLine("Changes successfully saved in the DB.");
  13.             }
  14.             else
  15.             {
  16.                 Console.WriteLine("Conflict! Text from DB: {0}. Enter the corrected text:", firstNew.Content);
  17.             }
Advertisement
Add Comment
Please, Sign In to add comment