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());
        }
示例#2
0
        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));
        }
示例#4
0
        /// <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)])));
        }
示例#5
0
 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."));
 }
示例#7
0
 public IDataResult<List<CarImages>> GetAll(Expression<Func<CarImages, bool>> filter = null)
 {
     return new SuccessDataResult<List<CarImages>>(_carImagesDal.GetAll());
 }
示例#8
0
        public IDataResult <List <CarImage> > GetAll()
        {
            var result = carImagesDal.GetAll();

            return(new SuccessDataResult <List <CarImage> >(result));
        }
示例#9
0
        public IDataResult <List <CarImage> > GetByCarId(int carId)
        {
            List <CarImage> carImageList = _carImageDal.GetAll(c => c.CarId == carId);

            return(new SuccessDataResult <List <CarImage> >(carImageList));
        }
示例#10
0
 public IDataResult <List <CarImages> > GetAll()
 {
     return(new SuccessDataResult <List <CarImages> >(_carImagesDal.GetAll(), "Resimler Listelendi"));
 }