public CommonResult DeleteNews(DeleteNewsRequest request) { return _newsProvider.DeleteNews(request); }
public CommonResult DeleteNews(DeleteNewsRequest request) { var contentFile = $"{request.NewsId}_content.md"; var jsonFile = $"{request.NewsId}.json"; var rootPath = _hostingEnvironment.WebRootPath.Replace('\\', '/'); var contentPath = rootPath + Path.Combine(_newsPath, contentFile); var jsonPath = rootPath + Path.Combine(_newsPath, jsonFile); if (File.Exists(contentPath) && File.Exists(jsonPath)) { File.Delete(contentPath); File.Delete(jsonPath); return CommonResult.Success(); } else { return CommonResult.Failure("News o podanym Id nie istnieje."); } }