/// <summary>
        /// Reverts the Author of the Book to the original Author prior to changes.
        /// </summary>
        private void RevertAuthor()
        {
            //Revert Book.Author
            if (originalAuthor != null)
            {
                //Revert Author
                Book.Author          = originalAuthor;
                Book.Author_PersonId = originalAuthor.PersonId;

                //Revert MAuthor in local collection
                List <MAuthor> authorList = controller.GetAuthorsList();
                foreach (MAuthor ma in authorList)
                {
                    if (ma.ID == originalAuthor.PersonId)  //if MAuthor is original Author, add the Book to the MAuthor
                    {
                        ma.Books.Add(Book);
                    }
                    else  //Remove Book from MAuthor hwo is not original author
                    {
                        ma.Books.Remove(Book);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Populates AuthorsTreeView with all MAuthor objects in collection
        /// </summary>
        private void LoadAuthorsList()
        {
            ObservableCollection <MAuthor> authorsList = new ObservableCollection <MAuthor>(controller.GetAuthorsList());

            AuthorsTreeView.ItemsSource = authorsList;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Loads all MAuthors in collection to ObservableCollection authorsList
 /// </summary>
 private void LoadAuthors()
 {
     authorList = new ObservableCollection <MAuthor>(
         (from a in controller.GetAuthorsList()
          select a).ToList());
 }