public BookInfo(int? BookId = null) { if (BookId != null) { using (var db = new BookshelfDbContext()) { Book = db.Books.Where(x => x.Id == BookId).FirstOrDefault(); } } }
public static List<Book> BooksListBySeries(Series series, Book current = null) { using (var db = new BookshelfDbContext()) { return db.Books .Where(x => x.Series.Id == series.Id && (current == null || x.Id != current.Id)) .OrderBy(x => x.Name) .ToList(); } }