private IResult CheckImageCount(int carId) { int result = _carImageDal.GetAll(x => x.CarId == carId).Count; if (result >= 5) { return(new ErrorResult(Messages.ImageCountOverflow)); } return(new SuccessResult()); }
public IResult DeleteByCarId(int carId) { var result = _carImageDal.GetAll(c => c.CarId == carId); if (result.Any()) { foreach (var carImage in result) { Delete(carImage); } return(new SuccessResult()); } return(new ErrorResult(Messages.CarHaveNoImage)); }
public IDataResult <List <CarImage> > GetCarImagesByCarId(int carId) { var result = _carImagesDal.GetAll(ci => ci.CarId == carId); if (!result.Any()) { return(new SuccessDataResult <List <CarImage> >(new List <CarImage> { new CarImage { ImagePath = "default.png" //TODO: apng isimli gifimsi png } })); } return(new SuccessDataResult <List <CarImage> >(result)); }
/// <summary> /// All Car data will be removed when the car delete /// </summary> /// <param name="id">Car Id</param> /// <returns></returns> public IResult Delete(int id) { var DeletedCar = GetById(id).Data; cardal.Delete(DeletedCar); var DeletedCarImages = carImagesDal.GetAll(pre => pre.CarId == DeletedCar.Id); foreach (var deletedCarImage in DeletedCarImages) { carImagesDal.Delete(deletedCarImage); if (!deletedCarImage.ImagePath.Equals("thumbnail.png")) { fileProcess.Delete(deletedCarImage.ImagePath); } } return(new SuccessResult(Messages.Delete_Message(Messages.GetNameDict[typeof(Car)]))); }
public IDataResult <List <CarImage> > GetAll() { return(new SuccessDataResult <List <CarImage> >(_carImagesDal.GetAll())); }
public IDataResult <List <CarImage> > GetAll() { return(new SuccessDataResult <List <CarImage> >(_carImagesDal.GetAll(), "Bütün resimler listelendi.")); }
public IDataResult<List<CarImages>> GetAll(Expression<Func<CarImages, bool>> filter = null) { return new SuccessDataResult<List<CarImages>>(_carImagesDal.GetAll()); }
public IDataResult <List <CarImage> > GetAll() { var result = carImagesDal.GetAll(); return(new SuccessDataResult <List <CarImage> >(result)); }
public IDataResult <List <CarImage> > GetByCarId(int carId) { List <CarImage> carImageList = _carImageDal.GetAll(c => c.CarId == carId); return(new SuccessDataResult <List <CarImage> >(carImageList)); }
public IDataResult <List <CarImages> > GetAll() { return(new SuccessDataResult <List <CarImages> >(_carImagesDal.GetAll(), "Resimler Listelendi")); }