private void FillBooks()//fill all books which are active { foreach (Book item in _bookService.All()) { if (item.isActive)//check if book is active { DgvBooks.Rows.Add(item.Id, item.Title, item.Price, item.Author, item.Count); } } }
private void FillAllBooks()//fills the books to datagridview which are active and their counts are greater than 0 { foreach (Book item in _bookService.All()) { if (item.Count > 0 && item.isActive == true) { DgvAllBooks.Rows.Add(item.Id, item.Title, item.Price, item.Author); } } }
public async Task AllShouldReturnCorrectCount() { this.InitializeMapper(); var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); await this.SeedBooksAsync(dbContext); var repository = new EfDeletableEntityRepository <Book>(dbContext); var categoryRepository = new EfDeletableEntityRepository <Category>(dbContext); var service = new BookService(repository, categoryRepository); var actualResult = service.All <BookDetailViewModel>().Count(); Assert.Equal(repository.All().Count(), actualResult); }
private void FillClientBooks()//fill all orders of selected client { if (_SelectedCli != null) { CmbClient.SelectedItem = new ComboItem(_SelectedCli.Id, _SelectedCli.Fullname); CmbClient.Text = _SelectedCli.Fullname; foreach (Book item in _bookService.All()) { foreach (Order orderItem in _orderService.Orders()) { if (orderItem.ClientId == _SelectedCli.Id && item.Id == orderItem.BookId) { DgvOrders.Rows.Add(orderItem.Id, orderItem.Book.Title, orderItem.OrderDate, orderItem.MustReturnAt, orderItem.Cost, orderItem.Returned); } } } } }