Пример #1
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,
                    SurveyCount = _surveyRepository.Count(x => x.SurveyTakerId == customer.CustomerId)
                });
            }

            return(View(customerVM));
        }