static void InsertBook() { Books book = new Books(); book.Quantity = true; Console.WriteLine("Input the new books title"); book.Title = Console.ReadLine(); Console.WriteLine("Input the new books publisher"); book.Publisher = Console.ReadLine(); Console.WriteLine("Input the year of the publishing (no books below 1800 are allowed)"); string temp = Console.ReadLine(); if (IntVerification(temp, 1800, 2016)) { book.DatePublised = Int32.Parse(temp); } else { Console.WriteLine("Try again..make sure you input a year between 1800 and 2016..if you fail the default will be given - 1900"); temp = Console.ReadLine(); if (IntVerification(temp, 1800, 2016)) { book.DatePublised = Int32.Parse(temp); } else { book.DatePublised = 1900; } } Console.WriteLine("Input the number of pages (makes sure its a reasonable number)"); temp = Console.ReadLine(); if (IntVerification(temp, 1, Int32.MaxValue)) { book.DatePublised = Int32.Parse(temp); } else { Console.WriteLine("Try again..make sure you input a year between 1800 and 2016..if you fail the default will be given - 500"); temp = Console.ReadLine(); if (IntVerification(temp, 1, Int32.MaxValue)) { book.DatePublised = Int32.Parse(temp); } else { book.DatePublised = 500; } } Console.WriteLine("Insert an ISBN code for the book (it must be unique for every book and is a 4 digit int)"); bool check = true; temp = Console.ReadLine(); while (check) { foreach (var bok in context.Books) { if (bok.ISBN == temp) { Console.WriteLine("You must input a different ISBN, this one is being used"); temp = Console.ReadLine(); } } check = false; book.ISBN = temp; } context.Books.Add(book); context.SaveChanges(); }