Пример #1
0
 private void BtnRead_Click(object sender, EventArgs e)
 {
     if (BookDetailReply.HostLibrary)
     {
         Domain.Entities.Book oBook =
             db.Books.Where(current => current.Name == BookDetailReply.Name)
             .FirstOrDefault();
         if (oBook != null)
         {
             ReadBook ReadBookForm = new ReadBook();
             ReadBookForm.setBook(oBook);
             ReadBookForm.SetAuthenicatedUser(authenicatedUser);
             ReadBookForm.Show();
         }
     }
     else
     {
         if (BookDetailReply.RentedThisBook)
         {
             WSReadBook ReadBookForm = new WSReadBook();
             ReadBookForm.setBook(BookDetailReply.Text);
             ReadBookForm.SetAuthenicatedUser(authenicatedUser);
             ReadBookForm.Show();
         }
     }
 }
        private void BtnRead_Click(object sender, EventArgs e)
        {
            Domain.Entities.Book oBookInNewContext =
                db.Books.Find(Book.Id);
            if (oBookInNewContext != null)
            {
                db.Entry(oBookInNewContext).Reload();

                ReadBook ReadBookForm = new ReadBook();
                ReadBookForm.setBook(oBookInNewContext);
                ReadBookForm.SetAuthenicatedUser(authenicatedUser);
                ReadBookForm.Show();
            }
        }