public IActionResult GetCarDetailByCarId(int id) { var result = _carService.GetCarDetailByCarId(id); if (result.Data.CarImages.Count <= 0) { result.Data.CarImages.Add(new CarImage() { CarId = result.Data.CarId, ImagePath = ImageUploadHelper.DefaultImagePath() }); } if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetCarDetailsByBrandAndColorid(int brandId, int colorId) { var result = _carService.GetCarDetailsByBrandAndColorid(brandId, colorId); foreach (var item in result.Data) { if (item.CarImages.Count <= 0) { item.CarImages.Add(new CarImage() { CarId = item.CarId, ImagePath = ImageUploadHelper.DefaultImagePath() }); } } if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }