gpt4 book ai didi

c# - ASP.NET MVC 没有匹配的返回类型

转载 作者:行者123 更新时间:2023-11-30 22:39:42 25 4
gpt4 key购买 nike

我的存储库中有以下代码:

public PerformanceDetails performanceDetails(String name, String year)
{
var PerformanceDetails = (from s in _db.PerformanceDetails where s.venue == name && s.year == year select s).First();

return PerformanceDetails;
}

然后这是界面:

Performance performanceDetails(String name, String year);

在 Controller 中我有以下 ActionResult:

public ActionResult Details(String name, String year)
{
return View(_repository.performanceDetails(name, year));
}

据我所知,这应该没问题,但是当我尝试构建解决方案时,它给出了一条错误消息:

Error 1 'u0558234_assignment2.Models.StageRepository' does not implement interface member 'u0558234_assignment2.Models.IStageRepository.performanceDetails(string, string)'. 'u0558234_assignment2.Models.StageRepository.performanceDetails(string, string)' cannot implement 'u0558234_assignment2.Models.IStageRepository.performanceDetails(string, string)' because it does not have the matching return type of 'u0558234_assignment2.Models.Performance'. C:\Users\cameron\Desktop\u0558234_assignment2\u0558234_assignment2\Models\StageRepository.cs 8 18 u0558234_assignment2

知道问题出在哪里吗?谢谢

最佳答案

performanceDetails 的实现返回的是 PerformanceDetails 而不是 Performance

关于c# - ASP.NET MVC 没有匹配的返回类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5596141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com