Example #1
0
        //[ValidationAspect(typeof(CarImageValidator))]
        public IResult Add(IFormFile file, CarImage entity)
        {
            IResult result = BussinessRules.Run(CheckCarImages(entity.CarId), CheckCarId(entity.CarId), CheckIfImageExtension(file.FileName));

            if (result != null)
            {
                return(result);
            }
            entity.ImagePath = FileHelper.AddAsnyc(file);
            entity.Date      = DateTime.Today;
            _carImageDal.Add(entity);
            return(new SuccessResult(Messages.Added));
        }