public void UpdateDataInLstBook(List <Book> listOfBooks)
 {
     BookOverview.DataSource = typeof(List <Book>);
     BookOverview.DataSource = listOfBooks;
     BookOverview.Refresh();
     BookOverview.AutoSize = true;
 }
        public IEnumerable <BookOverview> Add(string name, string description, string category)
        {
            var entity = new BookOverview(-1, name, description, category);

            this._repo.Register(entity);
            this._searchRepository.Register(entity);
            return(this._repo.GetBookOverviews());
        }
Ejemplo n.º 3
0
        //private void Button_Click_6(object sender, RoutedEventArgs e)
        //{
        //    BookView.Content = BookLoader.First;
        //    BookLoader.Position = 0;
        //}

        //private void Button_Click_7(object sender, RoutedEventArgs e)
        //{
        //    BookView.Content = BookLoader.Prev;
        //    BookLoader.Position--;
        //}

        //private void Button_Click_8(object sender, RoutedEventArgs e)
        //{
        //    BookView.Content = BookLoader.Next;
        //    BookLoader.Position++;
        //}

        //private void Button_Click_9(object sender, RoutedEventArgs e)
        //{
        //    BookView.Content = BookLoader.Last;
        //    BookLoader.Position = AppCur.LibraryData.Books.Count;
        //}

        private void Button_Click_10(object sender, RoutedEventArgs e)
        {
            var bookLoader = new PageLoader(AppCur.LibraryData.Books.ToList <object>(), typeof(BookOverview));

            bookLoader.Position = BookGrid.SelectedIndex;
            var current = new BookOverview(BookGrid.SelectedValue);
            var window  = new PaginalView(bookLoader, current);

            window.ShowDialog();
        }
        public void Register(BookOverview book)
        {
            this._ctx.Command.CommandText = $@"
INSERT INTO books
(
  `name`,
  `description`,
  `category`
)
VALUES
(
  @name,
  @description,
  @category
)";
            this._ctx.Command.Parameters.AddWithValue("@name", book.Name);
            this._ctx.Command.Parameters.AddWithValue("@description", book.Description);
            this._ctx.Command.Parameters.AddWithValue("@category", book.Category);
            this._ctx.Command.ExecuteNonQuery();
            this._ctx.Command.Parameters.Clear();

            this._ctx.Command.CommandText = "SELECT last_insert_id();";
            book.Id = int.Parse(this._ctx.Command.ExecuteScalar().ToString());
        }
 public void Register(BookOverview book)
 {
   this._ctx.Client.IndexDocument(book);
 }