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

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

            carImage.ImagePath = CarImageFileHelper.Add(file);
            carImage.Date      = DateTime.Now;
            _carImageDal.Add(carImage);
            return(new SuccessResult(Messages.CarImageAdded));
        }
Ejemplo n.º 2
0
        public IResult Add(IFormFile file, CarImage carImage)
        {
            IResult result = BusinessRules.Run(CheckImageLimitExceeded(carImage.CarId));

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

            carImage.ImagePath = CarImageFileHelper.Add(file);
            carImage.Date      = DateTime.Now;
            _carImageDal.Add(carImage);
            return(new SuccessResult());
        }
Ejemplo n.º 3
0
        // [ValidationAspect(typeof(CarImageValidator))]
        public IResult Add(CarImage carImage, IFormFile file)
        {
            IResult result = BusinessRules.Run(CheckIfImageLimitExpired(carImage.CarId),
                                               CheckIfImageExtensionValid(file));

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

            carImage.ImagePath = CarImageFileHelper.Add(file);
            carImage.Date      = DateTime.Now;
            _carImageDal.Add(carImage);

            return(new SuccessResult());
        }