public ActionResult ProjectmanagerDashboard() { if (!User.IsInRole("projectmanager")) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var projects = p.GetAllProjects(); List <ProjectViewModel> ProjectForView = new List <ProjectViewModel>(); projects.ForEach(proj => { ProjectViewModel projectView = new ProjectViewModel(); projectView.Id = proj.Id; projectView.Title = proj.Title; projectView.Discription = proj.Discription; projectView.DeadLine = proj.DeadLine; projectView.priority = proj.priority; if (proj.tasks != null && proj.tasks.Count != 0) { projectView.Tasks = new List <TaskWithUser>(); proj.tasks.ToList().ForEach(t => { TaskWithUser taskWithUser = new TaskWithUser(); taskWithUser.Id = t.Id; taskWithUser.notes = t.notes; taskWithUser.priority = t.priority; taskWithUser.ProjectId = t.ProjectId; taskWithUser.TaskDetails = t.TaskDetails; taskWithUser.TaskTitle = t.TaskTitle; taskWithUser.userId = t.userId; taskWithUser.developer = p.GetUserEmail(t.userId); projectView.Tasks.Add(taskWithUser); }); } else { projectView.Tasks = new List <TaskWithUser>(); } ProjectForView.Add(projectView); }); ViewBag.Notification = "notifications"; p.GetAllProjectsPassedDeadlineId().ForEach(id => { p.UpdateNotificationTable(id, NotificationOptions.ProjectPassedDeadline.ToString(), false); }); taskManager.GetAllCompletedTaskId().ForEach(id => { p.UpdateNotificationTable(id, NotificationOptions.TaskCompletion.ToString(), false); }); p.GetAllCompletedProjectsId().ForEach(id => { p.UpdateNotificationTable(id, NotificationOptions.TaskCompletion.ToString(), false); }); ViewBag.Notification = "notifications" + "(" + p.NumberOfUpdates().ToString() + ")"; return(View(ProjectForView)); }
public ActionResult GetAllProjectsWithUnfinishedTasks() { List <Project> projects = p.GetAllProjectsWithUnfinishedTasks(); List <ProjectViewModel> ProjectForView = new List <ProjectViewModel>(); projects.ForEach(proj => { ProjectViewModel projectView = new ProjectViewModel(); projectView.Id = proj.Id; projectView.Title = proj.Title; projectView.Discription = proj.Discription; projectView.DeadLine = proj.DeadLine; projectView.priority = proj.priority; if (proj.tasks != null && proj.tasks.Count != 0) { projectView.Tasks = new List <TaskWithUser>(); proj.tasks.ToList().ForEach(t => { TaskWithUser taskWithUser = new TaskWithUser(); taskWithUser.Id = t.Id; taskWithUser.notes = t.notes; taskWithUser.priority = t.priority; taskWithUser.ProjectId = t.ProjectId; taskWithUser.TaskDetails = t.TaskDetails; taskWithUser.TaskTitle = t.TaskTitle; taskWithUser.userId = t.userId; taskWithUser.developer = p.GetUserEmail(t.userId); projectView.Tasks.Add(taskWithUser); }); } else { projectView.Tasks = new List <TaskWithUser>(); } ProjectForView.Add(projectView); }); return(View(ProjectForView)); }