예제 #1
0
        private void NewBook()
        {
            var win             = new View.NewBookWindow();
            NewBookViewModel vm = (NewBookViewModel)win.DataContext;

            win.ShowDialog();

            if (Session.Current.LibraryProxy.CreateBook(vm.BookName, vm.Author, int.Parse(vm.PublicationYear)))
            {
                ClientLogger.Log($"Book {vm.BookName} successfully created.", Common.LogLevel.Info);
            }
            else
            {
                ClientLogger.Log($"Book {vm.BookName} could not be created.", Common.LogLevel.Error);
            }

            RefreshList();
        }
예제 #2
0
        private void EditBook()
        {
            var win             = new View.NewBookWindow();
            NewBookViewModel vm = (NewBookViewModel)win.DataContext;

            vm.BookName        = selectedBook.BookName;
            vm.Author          = selectedBook.Author.AuthorName;
            vm.PublicationYear = selectedBook.PublicationYear.ToString();

            win.ShowDialog();

            if (Session.Current.LibraryProxy.EditBook(selectedBook.BookName, vm.BookName, vm.Author, int.Parse(vm.PublicationYear)))
            {
                ClientLogger.Log($"Book {vm.BookName} successfully edited.", Common.LogLevel.Info);
            }
            else
            {
                ClientLogger.Log($"Book {vm.BookName} could not be edited.", Common.LogLevel.Error);
            }

            RefreshList();
        }