public async Task <IActionResult> GetPrductImageById(int id) { var image = await _repo.GetImageById(id); if (image == null) { return(NotFound()); } return(Ok(image)); }
public async Task <IActionResult> DeleteBanner(int id) { var banner = await _repo.GetImageById(id); if (banner == null) { return(NotFound()); } var deleteParams = new DeletionParams(banner.PublicId); var result = _cloudinary.Destroy(deleteParams); if (result.Result == "ok") { _repo.Delete(banner); } if (await _repo.SaveAll()) { return(Ok()); } return(BadRequest("Failed to delete banner")); }