Example #1
0
        public async Task <GetAllDevelopersQueryHandlerResponse> Handle(GetAllDevelopersQuery request, CancellationToken cancellationToken)
        {
            IReadOnlyList <Developer> listresult;

            if (request.queryWitchDataBase == QueryWitchDataBase.WithEventSourcing)
            {
                listresult = await _zEsRepository.GetCollectionAsync(request.Filter);
            }
            else
            {
                listresult = await _Repository.GetCollectionAsync(request.Filter);
            }

            if (listresult == null)
            {
                return(new GetAllDevelopersQueryHandlerResponse
                           (ResponseStatus.NotFoundInDataBase));
            }


            var allordered = listresult.OrderBy(x => x.Id);
            var allmaped   = _mapper.Map <List <DeveloperInListViewModel> >(listresult);

            return(new GetAllDevelopersQueryHandlerResponse(allmaped));
        }