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

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

            dialog.ShowDialog();

            return(dialog.DialogResult.GetValueOrDefault());
        }
Exemple #2
0
        public static BookGenre EditBookGenre(Window owner, GlobalDataObject gdo, object source, bool isNew = false, bool updateColection = true)
        {
            var entity = GetEntityForEditation <BookGenre>(owner, source, gdo.GetBookGenre, isNew);

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

            if (BookGenreEditorWindow.Open(entity))
            {
                gdo.SaveBookGenre(entity);

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

            return(entity);
        }