public static bool Open(BookAuthor dataObject)
        {
            if (dataObject == null)
            {
                throw new ArgumentNullException("dataObject");
            }

            var dialog = new BookAuthorEditorWindow()
            {
                DataContext           = dataObject,
                Owner                 = Registry.Get <MainWindow>(),
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Title                 = (dataObject.Id <= 0)
                    ? "Book Manager - New Book Author"
                    : String.Format("Book Manager - Book Author Edit {0}", dataObject.Id)
            };

            dialog.ShowDialog();

            return(dialog.DialogResult.GetValueOrDefault());
        }
Пример #2
0
        public static BookAuthor EditBookAuthor(Window owner, GlobalDataObject gdo, object source, bool isNew = false, bool updateColection = true)
        {
            var entity = GetEntityForEditation <BookAuthor>(owner, source, gdo.GetBookAuthor, isNew);

            if (entity == null)
            {
                return(null);
            }

            if (BookAuthorEditorWindow.Open(entity))
            {
                gdo.SaveBookAuthor(entity);

                if (updateColection)
                {
                    UpdateBookAuthorCollection(owner, gdo);
                }
            }

            return(entity);
        }