Exemplo n.º 1
0
        public void EditBook(int id)
        {
            Book book = BooksModel.GetBook(id);

            Window window = GetWindow(500, 600);

            BookFormViewModel formViewModel = new BookFormViewModel();

            formViewModel.Id     = book.Id.Value;
            formViewModel.Author = book.Author;
            formViewModel.Title  = book.Title;
            if (book.Cover != null)
            {
                formViewModel.ImageSource = BooksModel.GetCoverFromBytes(book.Cover);
            }
            formViewModel.closeWindow = closeWindow;
            window.Content            = formViewModel;

            window.ShowDialog();
            LoadBooks();
        }