Display Data To Editor

1960Marylee

New Member
I really need help for this, I am new to mvc asp.net. My problem is how display the records that i query from different table into the editor view.\[code\]enter code here public ActionResult Edit(int id = 0) { SecurityGroup securitygroup = db.SecurityGroups.Single(s => s.Id == id); if (securitygroup == null) { return HttpNotFound(); } //collection of records I want to display. var sql = from a in db.SecurityDetails join b in db.SecurityGroups on a.SecurityGroupId equals b.Id join m in db.Menus on a.MenuId equals m.Id join d in db.Departments on b.DepartmentId equals d.Id where a.SecurityGroupId == id select new { menu = m.MenuName, name = b.Name, dept = d.DepartmentName, desc = b.Description, view = a.CanView, add = a.CanAdd, edit = a.CanEdit, active = a.IsActive }; //How can I display these records into the Edit view? Please help me! Thanks ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", securitygroup.DepartmentId); return View(securitygroup); }\[/code\]
 
Back
Top