예제 #1
0
        public IDataResult <List <CarDetailDto> > GetAllCarsDetails()
        {
            var result = _carDal.Any();

            if (!result)
            {
                return(new ErrorDataResult <List <CarDetailDto> >(Messages.NotFound()));
            }
            return(new SuccessDataResult <List <CarDetailDto> >(_carDal.GetCarsDetails()));
        }
예제 #2
0
        private IResult CheckCarIdExist(int carId)
        {
            var result = _carDal.Any(c => c.Id == carId);

            if (!result)
            {
                return(new ErrorResult(Messages.NotFound));
            }

            return(new SuccessResult());
        }
예제 #3
0
 private IResult CheckIfCarNameExists(string carName)
 {
     if (!String.IsNullOrEmpty(carName))
     {
         var result = _carDal.Any(x => x.CarName.ToLower().Contains(carName.ToLower()));
         if (!result)
         {
             return(new SuccessResult());
         }
     }
     return(new ErrorResult());
 }
예제 #4
0
        public IDataResult <List <Car> > GetAllByCarTypeId(int carTypeId)
        {
            var result = _carDal.Any(c => c.CarTypeId == carTypeId);

            if (result)
            {
                return(new SuccessDataResult <List <Car> >(_carDal.GetAll(v => v.CarTypeId == carTypeId)));
            }
            return(new ErrorDataResult <List <Car> >(Messages.NotFound()));
        }