public GenericRepositoryTests()
 {
     InitContext();
     _repository.Add(GetPriceTreshold());
     _repository.Add(GetPriceTreshold());
     _repository.Add(GetPriceTreshold());
     _uow.Commit();
 }
Пример #2
0
        public override async Task <ServiceResult <IEnumerable <PriceTresholdBaseDto> > > GetAllAsync()
        {
            var count = Count();

            if (count.Result == 0)
            {
                _repository.Add(new PriceTreshold
                {
                    MinCharges     = 0,
                    PricePerCharge = 3
                });
                await _unitOfWork.CommitAsync();
            }
            return(ServiceResult <IEnumerable <PriceTresholdBaseDto> > .Success(_repository.GetAll(x => !x.IsDeleted).OrderBy(x => x.MinCharges).Select(_mapper.Map <PriceTresholdBaseDto>)));
        }