Esempio n. 1
0
        public void InsertData()
        {
            data.LibraryContext ctx  = new data.LibraryContext();
            data.Book           book = new data.Book();
            book.Title = "Origin of Species";

            ctx.Books.Add(book);

            ctx.SaveChanges();
        }
Esempio n. 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            data.LibraryContext ctx  = new data.LibraryContext();
            data.Book           book = new data.Book();
            book.Title       = this.title.Text;
            book.PublishYear = Convert.ToInt32(this.pubyear.Text);
            book.Format      = data.BookFormat.Paper;
            ctx.Books.Add(book);

            ctx.SaveChanges();
        }