Exemplo n.º 1
0
        public IActionResult Index(string searchTerm)
        {
            if (string.IsNullOrWhiteSpace(searchTerm))
            {
                return(Index());
            }

            var query     = new SearchForCustomersQuery(searchTerm);
            var customers = _queryProcessor.Process(query);
            var vm        = new CustomerViewModel
            {
                Customers  = customers,
                SearchTerm = searchTerm
            };

            return(View(vm));
        }
Exemplo n.º 2
0
 public List <Customer> Handle(SearchForCustomersQuery query)
 {
     return(_repository.GetCustomersByQuery(query.SearchTerm));
 }