public IActionResult Add([FromForm(Name = ("Image"))] IFormFile formFile, [FromForm] CarImage carImage) { var result = _carImageService.AddCarImage(formFile, carImage); if (result.Success) { return Ok(result); } return BadRequest(result); }
public IActionResult Add([FromForm] CarImage carImage, [FromForm(Name = "Image")] IFormFile file) { var result = _carImageService.AddCarImage(carImage, file); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult CarImageToAdd(AddImageViewModel addImageView) { if (ModelState.IsValid) { try { bool added = _carImgService.AddCarImage(addImageView); if (added) { return(Ok(new { Value = "New image added" })); } return(Ok(new { Value = "Image was not added, try again." })); } catch { return(View("Error", new ErrorViewModel { RequestId = "A database error occured" })); } } return(View(nameof(Create))); }
public JsonResult AddCarImages([FromBody] CarImages request) { return(Json(_service.AddCarImage(request))); }