Пример #1
0
            public async Task <List <DistributorVM> > Handle(ListDistributorsInMyAreaQuery request, CancellationToken cancellationToken)
            {
                // Get Current Customer form the current logged in customer
                var customer = await _mediator.Send(new CustomerByAccountIdQuery { AccountId = _currentUserService.UserId }, cancellationToken);


                // get distributors paginated form the database
                var distributorsFromRepo = await _distributorsRepository.GetDistributorsInAreaAsync(customer.Area.Id);

                // mapping distributors to cusotmers view models
                var distributorsToReturn = _mapper.Map <List <DistributorVM> >(distributorsFromRepo);

                return(distributorsToReturn);
            }