コード例 #1
0
        public IActionResult Index()
        {
            var homeVM = new HomeViewModel()
            {
                BandCount      = _bandRepository.Count(x => true),
                CustomerCount  = _customerRepository.Count(x => true),
                AlbumCount     = _albumRepository.Count(x => true),
                LendAlbumCount = _albumRepository.Count(x => x.Borrower != null)
            };

            return(View(homeVM));
        }
コード例 #2
0
        public IActionResult List()
        {
            var customerVM = new List <CustomerViewModel>();

            var customers = _customerRepository.GetAll();

            if (customers.Count() == 0)
            {
                return(View("Empty"));
            }

            foreach (var customer in customers)
            {
                customerVM.Add(new CustomerViewModel
                {
                    Customer   = customer,
                    AlbumCount = _albumRepository.Count(x => x.BorrowerId == customer.CustomerId)
                });
            }

            return(View(customerVM));
        }
コード例 #3
0
 public int Count()
 {
     return(AlbumRepository.Count());
 }
コード例 #4
0
        public void GetCountAlbum()
        {
            var cantidad = albumRepository.Count();

            Assert.IsTrue(cantidad > 0, "OK");
        }