Ejemplo n.º 1
0
            public async Task <ListEntityVM <CityVM> > Handle(ListCitiesQuery request, CancellationToken cancellationToken)
            {
                // get citys paginated form the database
                var citysFromRepo = await _distributorsRepository.GetAllCitiesAsync(request.PageNumber, request.PageSize, request.KeyWord);

                // mapping citys to cusotmers view models
                var citysToReturn = _mapper.Map <List <CityVM> >(citysFromRepo.Item2);

                return(new ListEntityVM <CityVM> {
                    TotalCount = citysFromRepo.Item1, Data = citysToReturn
                });
            }