public IResult Add(IFormFile file, CarImage carImage)
        {
            IResult result = BusinessRules.Run(CheckImageLimitExceeded(carImage.CarId));

            if (result != null)
            {
                return(result);
            }
            carImage.ImagePath = ImageFileHelper.Add(file);
            carImage.Date      = DateTime.Now;
            _carImageDal.Add(carImage);
            return(new SuccessResult());
        }
        public IResult Add(CarImage carImage, IFormFile formFile)
        {
            var imagecount = _carImageDal.GetAll(i => i.CarId == carImage.CarId).Count;

            if (imagecount >= 5)
            {
                return(new ErrorResult(Messages.CheckIfImageLimit));
            }
            carImage.ImagePath = ImageFileHelper.Add(formFile);
            carImage.Date      = DateTime.Now;
            _carImageDal.Add(carImage);
            return(new SuccessResult(Messages.ImageAdded));
        }
        public IResult Add(Image image, IFormFile file)
        {
            IResult result = BusinessRules.Run(CheckIfImageLimitBorder(image.CarId), CheckIfImageExtensionValid(file));

            if (result != null)
            {
                return(result);
            }

            image.ImagePath = ImageFileHelper.Add(file);
            image.Date      = DateTime.Now;
            _imageDal.Add(image);
            return(new SuccessResult(Messages.ImageAdded));
        }
        public IResult Add(CarImage carImage, IFormFile file)
        {
            IResult result = BusinessRules.Run(
                CheckIfImageLimitExpired(carImage.CarId),
                CheckIfImageExtensionValid(file)
                );

            if (result != null)
            {
                return(result);
            }

            carImage.ImagePath = ImageFileHelper.Add(file);
            carImage.Date      = DateTime.Now;
            _carImageDal.Add(carImage);
            return(new SuccessResult());
        }