public IActionResult DeleteImgAsync(int idAp, string filename) { var path = $"/data/pictures/{idAp}/{filename}"; try { _logger.LogDebug("Deleting picture " + path); System.IO.File.SetAttributes(path, FileAttributes.Normal); System.IO.File.Delete(path); TrueHomeContext.DeletePictureRefAsync(idAp, filename); return(Ok()); } catch (FileNotFoundException) { _logger.LogError("Picture not found!"); return(NotFound()); } }