c# - 将函数从一个服务传递和调用到另一个服务
问题描述
我写了一个函数来获取和更新我需要的东西。
public async Task<bool> UpdateWellFile(IEnumerable<AttachedFileListView> files, string wellId)
{
var updateFiles = await _attachedFileRepo.GetAllQueryable().Where(af => af.WellId == wellId).ToListAsync();
if (files == null)
{
throw new ServiceException("File Not Found.");
}
foreach(var file in files)
{
var updateFile = updateFiles.SingleOrDefault(af => af.Id == file.Id);
updateFile.Category = file.Category;
_attachedFileRepo.Update(updateFile);
}
await _attachedFileRepo.CommitAsync();
return true;
}
这是在我的 AttachedFile 界面中
public interface IAttachedFileService
{
Task<IEnumerable<AttachedFileListView>> GetWellAttachedFiles(string wellId);
Task<string> SaveFile(IFormFile file, string wellId, string userId);
Task<IEnumerable<string>> SaveFiles (IEnumerable<IFormFile> files, string wellId, string userId);
Task<bool> UpdateWellFile(IEnumerable<AttachedFileListView> files, string wellId);
Task<AttachedFile> GetFile(string fileId);
Task<string> DeleteFile(string fileId);
}
现在我需要将这个 updateWellFile 函数传递给 WellService 并调用它,所以我将它添加到服务中,但它抛出了这个错误
这是很好的服务,我添加了“accountservice”,所以我不确定它还需要什么
解决方案
推荐阅读
- cplex - 多维变量集上的 CPLEX 条件
- python - 为什么 def 函数不会与我的最后一个打印行计算相同的答案?
- sql-server - 如何执行来自不同 SQL Server 的 2 个查询的联合?
- android - RecylerView 适配器在不工作的片段中
- java - 网络安全策略不允许与 XXX.XXX.XXX.XXX 进行 CLEARTEXT 通信
- python - 如果值为浮点数,则选择 Pandas 数据框中的行
- javascript - 有没有人可以帮助我处理混淆代码
- javascript - Javascript 点击按钮
- docker - Docker 本地主机在 Firefox 上不起作用,但在 Chromium 上,Curl 它的作品
- c++ - 这个对象数组如何初始化每个对象的成员变量?