// GET: Projects public ActionResult Index() { var dashboardView = new DashboardView(); var user = db.Users.Find(User.Identity.GetUserId()); dashboardView.myProjects = db.Projects.ToList(); if (userRoles.ListUserRoles(user.Id).FirstOrDefault() == "Developer") { dashboardView.myProjects = userProjectsHelper.ListProjectsForUser(user.Id); } if (userRoles.ListUserRoles(user.Id).FirstOrDefault() == "Project_Manager") { dashboardView.myProjects = userProjectsHelper.ListProjectsForUser(user.Id); } if (userRoles.ListUserRoles(user.Id).FirstOrDefault() == "Submitter") { dashboardView.myProjects = userProjectsHelper.ListProjectsForUser(user.Id); } return(View(dashboardView)); }
// GET: Projects public ActionResult Index() { if (User.Identity.IsAuthenticated) { var projectList = db.Projects.ToList(); db.Projects.Include(p => p.Description); return(View(projectList)); } else { var userId = User.Identity.GetUserId(); var projectList = PHelper.ListProjectsForUser(userId); ViewBag.Tickets = db.Tickets; var UserList = new SelectList(userId, "Id", "DisplayName"); ViewBag.UserList = UserList; ViewBag.AssignedtoUser = new SelectList(db.Users, "Id", "DisplayName"); return(View(projectList)); } }