public async Task <IActionResult> Delete(string imageHash, [FromHeader] string Authorization) { try { _logger.LogInformation("Delete image: " + imageHash); var imageBase = await _imagesService.DeleteAsync(imageHash, Authorization); string jsonContent = JsonConvert.SerializeObject(imageBase); return(Ok(jsonContent)); } catch (Exception ex) { var code = int.Parse(ex.Message.Split(' ').FirstOrDefault(s => s.All(char.IsDigit))); _logger.LogError($"Something went wrong: {ex}"); return(StatusCode(code, ex.Message)); } }
public async Task <ActionResult <ImageDto> > Delete([FromRoute] int?id) { var response = await _imagesService.DeleteAsync(new DeleteImageDto { Id = id }); return(Ok(response)); }