public async Task <IActionResult> DeleteImage(int productId, int imageId) { var result = await _manageProductService.RemoveImage(productId, imageId); if (result == 0) { return(BadRequest()); } return(Ok()); }
public async Task <IActionResult> RemoveImage(int imageId) { var result = await _manageProductService.RemoveImage(imageId); if (result == 0) { return(NotFound("Cannot find product")); } return(Ok()); }
public async Task <IActionResult> RemoveImage(int imageId) { if (!ModelState.IsValid) { return(BadRequest()); } var result = await _manageProductService.RemoveImage(imageId); if (result == 0) { return(BadRequest()); } return(Ok()); }
public async Task <ActionResult> RemoveImage(int productId, int imageId) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var image = await _manageProductService.RemoveImage(imageId); if (productId == 0) { return(BadRequest()); } //return Created(nameof(GetById), productId); //return CreatedAtAction(nameof(GetImageById), new { id = imageId }, image); return(Ok()); }