List<Models.ViewModels.GetCVList_ViewModel> list = _context.Can_CVs
.Where(x => x.isDeleted == false)
.Select(x => new GetCVList_ViewModel { x.Title, x.CVID, x.CityID, x.EditDate, x.AddDate })
.ToList();
此代码 我使用CV表特定列列出。 但列类型不同,所以我不能
我该怎么办?感谢
答案 0 :(得分:1)
你应该将每个模型属性分配给相应的viewmodel propety:
.Select(x => new GetCVList_ViewModel
{
Title = x.Title,
CVID = x.CVID,
CityID = x.CityID,
EditDate = x.EditDate,
AddDate = x.AddDate
})