public void RefreshPublishersAndAuthors() { var p = new PublisherDomain(); var all = p.GetAllPublishers(); if (all != null) { all = all.GroupBy(r => r.Name).Select(y => y.First()).ToList(); all.Insert(0, new Publisher { Name = "All Publishers" }); if (Books != null) { PublishersList = new ObservableCollection <Publisher>(all); } } var a = new AuthorDomain(); var allAuthors = a.GetAllAuthors(); if (allAuthors == null) { return; } allAuthors = allAuthors.GroupBy(o => o.FullName).Select(g => g.First()).ToList(); allAuthors.Insert(0, new Author { FirstName = "All Authors" }); if (Books != null) { AuthorsList = new ObservableCollection <Author>(allAuthors); } }
public void RefreshPublishersAndAuthors() { var p = new PublisherDomain(); var all = p.GetAllPublishers(); if (all != null) { all = all.GroupBy(r => r.Name).Select(y => y.First()).ToList(); all.Insert(0, new Publisher {Name = "All Publishers"}); if (Books != null) { PublishersList = new ObservableCollection<Publisher>(all); } } var a = new AuthorDomain(); var allAuthors = a.GetAllAuthors(); if (allAuthors == null) { return; } allAuthors = allAuthors.GroupBy(o => o.FullName).Select(g => g.First()).ToList(); allAuthors.Insert(0, new Author {FirstName = "All Authors"}); if (Books != null) { AuthorsList = new ObservableCollection<Author>(allAuthors); } }