private PartialViewResult ShowDevelopers(int projectId) { List<DeveloperListElement> model = new List<DeveloperListElement>(); int userId = int.Parse(User.Identity.GetProjectUserId()); var managerTask = new TaskManager(); var managerProject = new ProjectUserManager(); ViewData["projectId"] = projectId; ViewData["isLeader"] = managerProject.IsLeader(userId, projectId); ViewData["isDone"] = managerProject.GetProject(projectId).Done; var tasks = managerTask.GetTasksForProject(projectId); var users = managerProject.GetUsersForProject(projectId); foreach (var u in users) { var workHours = managerTask.GetAllWorkTimeForUser(u.Id, projectId) .Sum(w => w.EndTime.Subtract(w.StartTime).TotalSeconds); int tasksDone = tasks.Where(t => t.State == managerTask.GetDoneStateId()).Count(); int tasksAssigned = managerTask.GetAssignedTasks(u.Id, projectId).Count(); model.Add(new DeveloperListElement(u, (int)(workHours / 3600), tasksDone, tasksAssigned)); } return PartialView("_Developers", model); }