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())); }
private IResult CheckCarIdExist(int carId) { var result = _carDal.Any(c => c.Id == carId); if (!result) { return(new ErrorResult(Messages.NotFound)); } return(new SuccessResult()); }
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()); }
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())); }