我正在尝试更新记录并将更改保存到数据库中,但似乎我不能,因为我无法获取我的列表。抱歉,如果我的问题不清楚。
让我知道是否有其他方法可以做到。
List<ClaimHistoryModel.ClientLog> ClaimLogs = new List<ClaimHistoryModel.ClientLog>();
using (SidDbContext db = new SidDbContext())
{
var oldClaim = db.Client.FirstOrDefault(x => x.ClaimId == clientModel.ClaimId);
oldClaim.CellNumber = clientModel.CellNumber;
ClaimLogs = GetClaimLog(db); //here am getting a method which update the Logtbl.(all the changes will be saved) no error on this funstion
//it works if i save changes here but it won't update the history table which shows the fieds before and after.
db.claimAudit.AddRange(ClaimLogs ); Error here
db.SaveChanges();
}
收到此错误:
无法转换
System.Collections.Generic.List<ClaimHistoryModel.ClientLog>
为System.Collections.Generic.IEnumerable<claimAudit>