public IResult AddImage(IFormFile file, CarImages carImages)
        {
            IResult result = BusinessRules.Run(CheckLimitOfImages(carImages.CarId));

            if (result != null)
            {
                return(result);
            }
            carImages.ImagePath = FileHelper.Add(file);
            carImages.Date      = DateTime.Now;
            _ICarImagesDAL.Add(carImages);
            return(new SuccessResult(Messages.ImagesAdded));
        }
示例#2
0
        public IResult Add(IFormFile file, CarImages carImage)
        {    //, CheckIfImageExtensionValid(file)
            IResult result = BusinessRules.Run(
                CheckIfImageCountLimit(carImage.CarId)
                );

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

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