public IResult Add(IFormFile file, Images carImage) { var imageCount = _carImageDAL.GetAll(c => c.CarId == carImage.CarId).Count; if (imageCount >= 5) { return(new ErrorResult("One car must have 5 or less images")); } var imageResult = FileHelper.Upload(file); if (!imageResult.Success) { return(new ErrorResult(imageResult.Message)); } carImage.ImagePath = imageResult.Message; _carImageDAL.Add(carImage); return(new SuccessResult("Car image added")); }
public IResult Add(IFormFile file, Images carImage) { IResult result = BusinessRules.Run(CheckImageLimitExceeded(carImage.CarId)); if (result != null) { return(new ErrorDataResult <List <Images> >(result.Message)); } var imageResult = FileHelper.Upload(file); if (!imageResult.Success) { return(new ErrorResult(imageResult.Message)); } carImage.ImagePath = imageResult.Message; _imagesDal.Add(carImage); return(new SuccessResult("Resimler Eklendi.")); }
public IResult Add(IFormFile file, Images filmImage) { var imageCount = _filmImagesDal.GetAll(f => f.FilmId == filmImage.FilmId).Count; if (imageCount >= 5) { return(new ErrorResult("One film must have 5 or less images")); } var imageResult = FileHelper.Upload(file); if (!imageResult.Success) { return(new ErrorResult(imageResult.Message)); } filmImage.ImagePath = imageResult.Message; _filmImagesDal.Add(filmImage); return(new SuccessResult("film image added")); }