public IActionResult Add([FromForm] AddCarImageDto carIamgeDto) { var result = _carImageService.Add(carIamgeDto); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Message)); }
public IResult Add(AddCarImageDto carImageDto) { IResult result = BusinessRules.Run(CheckImageCount(carImageDto.CarId)); if (result != null) { return(result); } else { var imagePath = UploadImage(carImageDto.File); if (imagePath.Success) { CarImage carImage = new CarImage { ImagePath = imagePath.Data, CarId = carImageDto.CarId }; _carImageDal.Add(carImage); return(new SuccessResult(Messages.AddCarImage)); } } return(new ErrorResult(Messages.PictureLimitExceeded)); }