public void Cancel() { Book.TENSACH = dataProvider.GetItem <SACH>(x => x.MASACH == Book.MASACH).TENSACH; Book.NAMXB = dataProvider.GetItem <SACH>(x => x.MASACH == Book.MASACH).NAMXB; Book.ANHBIA = dataProvider.GetItem <SACH>(x => x.MASACH == Book.MASACH).ANHBIA; Author = AuthorList.FirstOrDefault(x => x.MATG == Book.MATG); Category = CategoryList.FirstOrDefault(x => x.MATL == Book.MATL); Publisher = PublisherList.FirstOrDefault(x => x.MANXB == Book.MANXB); if (string.IsNullOrEmpty(Book.ANHBIA) == true || File.Exists(Book.ANHBIA) == false) { Book.ANHBIA = @"/Resources/Images/Book/DefaultBook.jpg"; } }
public BookDetailViewModel(DataProvider dataProvider, IEventAggregator eventAggregator) : base(dataProvider, eventAggregator) { AuthorList = dataProvider.AuthorList; CategoryList = dataProvider.CategoryList; PublisherList = dataProvider.PublisherList; Book = dataProvider.SelectedBook; PublishRange = dataProvider.LibraryRules.KHOANGCACHXB ?? 0; eventAggregator.Subscribe(this); Author = AuthorList.FirstOrDefault(x => x.MATG == Book.MATG); Category = CategoryList.FirstOrDefault(x => x.MATL == Book.MATL); Publisher = PublisherList.FirstOrDefault(x => x.MANXB == Book.MANXB); DetailList = dataProvider.GetBookDetailList(x => x.MASACH == Book.MASACH); if (string.IsNullOrEmpty(Book.ANHBIA) == true || File.Exists(Book.ANHBIA) == false) { Book.ANHBIA = @"/Resources/Images/Book/DefaultBook.jpg"; } }
public static Author GetAuthor(int id) { return(AuthorList.FirstOrDefault(a => a.Id == id)); }