クエリを使用して、ソフトウェア名のリストを作成しようとし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);
}