Пример #1
0
 private void InitialiseEf()
 {
     using (var db = new MagicBooksContext())
     {
         var a = db.Books.Where(b => b.Large);
         db.SaveChanges();
     }
 }
Пример #2
0
        public BookViewModel SearchByIsbn(string isbn)
        {
            using (var db = new MagicBooksContext())
            {
                db.Database.CommandTimeout = 300;
                List <Book> books = db.Books
                                    .Where(b => b.Isbn == isbn)
                                    .Take(1)
                                    .ToList();

                if (books.Any())
                {
                    return(books.First().ToBookViewModel());
                }
            }
            return(new BookViewModel());
        }