public AuthorsController(Data.BookstoreContext db)
        {
            this.db = db;

            if (this.db.Authors.Count() == 0)
            {
                this.db.Authors.Add(new Author {
                    Id   = 1,
                    Name = "wiz khalifa"
                });

                this.db.Authors.Add(new Author
                {
                    Id   = 2,
                    Name = "Currency Spitta"
                });
                this.db.SaveChanges();
            }
        }
        public AuthorsController(Data.BookstoreContext db)
        {
            this.db = db;

            if (this.db.Authors.Count() == 0)
            {
                this.db.Authors.Add(new Author {
                    Id   = 1,
                    Name = "Lemony Snicket"
                });

                this.db.Authors.Add(new Author {
                    Id   = 2,
                    Name = "Stephen King"
                });

                this.db.SaveChanges();
            }
        }
        public BooksController(Data.BookstoreContext db)
        {
            this.db = db;

            if (this.db.Books.Count() == 0)
            {
                this.db.Books.Add(new Book {
                    Id    = 1,
                    Title = "The Lean Startup"
                });

                this.db.Books.Add(new Book
                {
                    Id    = 2,
                    Title = "Patterns of Enterprise Application Architecture"
                });
                this.db.SaveChanges();
            }
        }
        public AuthorController(Data.BookstoreContext db)
        {
            this.db = db;

            if (this.db.Authors.Count() == 0)
            {
                this.db.Authors.Add(new Author {
                    Id   = 1,
                    Name = "Allie Begg"
                });

                this.db.Authors.Add(new Author
                {
                    Id   = 2,
                    Name = "Nikki Youtzy"
                });

                this.db.SaveChanges();
            }
        }
Esempio n. 5
0
 public BooksController(Data.BookstoreContext db)
 {
     this.db = db;
     if (this.db.Books.Count() == 0)
     {
         this.db.Books.Add(new Book()
         {
             Id     = 1,
             Title  = "Design Patterns",
             Author = new Author()
             {
                 Name = "Erich Gamma"
             },
             ISBN = "978-0201633610"
         });
         this.db.Books.Add(new Book()
         {
             Id     = 2,
             Title  = "Continuous Delivery",
             Author = new Author()
             {
                 Name = "Jez Humble"
             },
             ISBN = "978-0321601919"
         });
         this.db.Books.Add(new Book()
         {
             Id     = 3,
             Title  = "The DevOps Handbook",
             Author = new Author()
             {
                 Name = "Gene Kim"
             },
             ISBN = "978-1942788003"
         });
     }
     this.db.SaveChanges();
 }
 public BooksController(Data.BookstoreContext db) => this.db = db;