با سلام
من می خواستم بدونم کد زیر که یک list رو مقدار دهی می کنم در View مدل چطور مقادیر رو داینامیک از کوئری که زدم پر کنم ؟ کجا باید foreach بزارم ؟
var myProduct = _db.tbl_Products.Find(id);
var model = new HomeViewModel
{
ControlList = new List<ControlInfo>
{
new ControlInfo
{
ControlType = "TextBox",
ControlName = "fistname",
ControlID = "firstname",
ControlLabel = "Name",
ControlValue = "Moien"
},
new ControlInfo
{
ControlType = "Checkbox",
ControlName = "isAdmin",
ControlID = "isAdmin",
ControlLabel = "Admin",
ControlValue = "Admin ?",
IsChecked = false
}
}
};
با تشکر