예제 #1
0
        public virtual async Task <IServiceResponse <IEnumerable <U> > > GetAsync()
        {
            var entities = await ExecuteWithoutTransactionAsync <IEnumerable <T> >(async() => await _unitOfWork.Repository <T>().GetAsync());

            var dtos = _mapper.Map <IEnumerable <U> >(entities);

            return(new ServiceResponse <IEnumerable <U> >(true, ServiceResponseMessage.Get_Success <T>(), dtos));
        }
예제 #2
0
        public virtual async Task <IServiceResponse <IEnumerable <U> > > GetRangeAsync(IEnumerable <int> Ids)
        {
            if (Ids == null || !Ids.Any())
            {
                return(new ServiceResponse <IEnumerable <U> >(false, ServiceResponseMessage.GetById_Success <IEnumerable <T> >()));
            }

            var response = await ExecuteWithoutTransactionAsync(async() => await _unitOfWork.Repository <T>().GetByIdRangeAsync(Ids));

            return(new ServiceResponse <IEnumerable <U> >(true, ServiceResponseMessage.Get_Success <IEnumerable <U> >(), _mapper.Map <IEnumerable <U> >(response)));
        }