我正在尝试db.tblSoftwares
通过使用查询来构建软件名称列表。
我尝试过使用.Add
方法,但它不起作用。
任何建议,将不胜感激。
public ActionResult Details(int id)
{
// this gets the hostname based on id//
tblComputer tblcomputer = db.tblComputers.Find(id);
var workstation = tblcomputer.HostName;
// next want to get the list of software names assigned to host name//
// get the list of licenses for hostname based on id/
var Licenses = (from n in db.tblLicenses
where n.tblComputerComputerId == id
select n.tblSoftwareSoftwareId).ToList();
List<string> appslist = new List<string>();
foreach (var l in Licenses)
{
var query1 = (from s in db.tblSoftwares
where s.SoftwareId == l
select new { s.Name }).ToList();
// appslist = query1;
}
var swList = new List<string> { "Adobe", "MS Office", "MS Visio" };
var ViewModel = new ComputerSoftwareViewModel
{
HostName = workstation,
Applications = swList
};
return View(ViewModel);
}