问题描述
当我使用我的模型值连接到数据库时,会出现此错误。任何人都可以帮助我
这里是我的代码:
公开覆盖列表< appdto>预约名单(int id)
{
List< appdto> dto = new List< appdto>();
List< appointment> db = _db.Appointments.Where(p => p.DID == id).ToList();
foreach(db中的var s)
{
var app = new AppDto();
app.PID = s.PID;
app.Title = s.Title;
app.Length = s.Length;
app.AppDate = s.AppDate;
dto.Add(app) ;
}
返回dto;
}
When i am connecting to the database with my model values then this error is getting. Can any one help me out
here is my code:
public override List<appdto> Appointmentlist(int id)
{
List<appdto> dto = new List<appdto>();
List<appointment> db = _db.Appointments.Where(p => p.DID==id).ToList();
foreach (var s in db)
{
var app = new AppDto();
app.PID = s.PID;
app.Title = s.Title;
app.Length = s.Length;
app.AppDate = s.AppDate;
dto.Add(app);
}
return dto;
}
这篇关于传递到字典中的模型项的类型为'System.Collections.Generic.List`1 [AppModels.Models.AppDto]',但此字典需要类型为'AppModels.Models.AppDto的模型项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!