Hi,
In the code below I am getting a specific photo record from db and then I am deleting it from cloudinary.
How I can delete it from db?
How to reference that in API?
[HttpDelete("delete-photo/{photoId}/{photoPublicId}")]
[Authorize]
public async Task<IActionResult> DeletePhoto(int photoId, string photoPublicId)
{
var photo = await uow.familyRepository.GetPhotoByIdAsync(photoId);
if (photo == null)
return BadRequest("No such photo exists");
var result = await photoService.DeletePhotoAsync(photo.PublicId);
// I need to delete the photo record from db!
if (result.Error != null)
return BadRequest(result.Error.Message);
if (await uow.SaveAsync()) return Ok();
return BadRequest("Some error has occured, failed to delete photo!");
}