예제 #1
0
        public async Task <IActionResult> Index(CustomerListCriteriaModel criteria, int pageIndex = 0, int pageSize = 20)
        {
            var customers = await _customerService.ListAsync(pageIndex : pageIndex, pageSize : pageSize,
                                                             userId : criteria.UserId,
                                                             term : criteria.Term
                                                             );

            var model = new CustomerListModel()
            {
                Criteria  = (criteria.UserId.HasValue || !string.IsNullOrEmpty(criteria.Term)) ? criteria : null,
                Customers = _mapper.Map <PagedResultModel <CustomerListItemModel> >(customers),
                Users     = _mapper.Map <IEnumerable <SelectListItem> >(await _userRepository.ListAsync(new UserFilterSpecification(onlyActive: true)))
            };

            return(View(model));
        }
예제 #2
0
 public IActionResult Index(CustomerListCriteriaModel criteria)
 {
     return(RedirectToAction(nameof(Index), criteria));
 }