// GET: Projects public ActionResult AllProjects() { AdminViewModel avm = new AdminViewModel(); //Populate project/pm view model List <PMViewModel> pm = new List <PMViewModel>(); foreach (var proj in db.Projects.ToList()) { PMViewModel pmvm = new PMViewModel(); pmvm.Project = proj; pmvm.PM = db.Users.Find(proj.PMID); pm.Add(pmvm); } avm.PVM = pm; //Populate tickets view model avm.Tickets = db.Tickets.ToList(); //Populate List <UserRolesViewModel> model = new List <UserRolesViewModel>(); UserRolesHelper helper = new UserRolesHelper(); var users = db.Users.ToList(); foreach (var u in users) { var urvm = new UserRolesViewModel(); urvm.User = u; urvm.Roles = helper.ListUserRoles(u.Id); model.Add(urvm); } avm.URVM = model; return(View(db.Projects.ToList())); }
public ActionResult Index() { List <PMViewModel> pm = new List <PMViewModel>(); foreach (var proj in db.Projects.ToList()) { PMViewModel pmvm = new PMViewModel(); pmvm.Project = proj; pmvm.PM = db.Users.Find(proj.PMID); pm.Add(pmvm); } return(View(pm)); }