public ActionResult AddDeveloper()
        {
            int userId = int.Parse(User.Identity.GetProjectUserId());
            int projectId = int.Parse(Request.Form["projectId"]);

            if (Request.Form["addUserId"] != null)
            {
                int developerId = int.Parse(Request.Form["addUserId"]);
                TempData["DetailsPage"] = "2";

                var manager = new ProjectUserManager();
                if (manager.IsLeader(userId, projectId))
                {
                    manager.AddDeveloperToProject(developerId, projectId);
                }
            }

            return Redirect("Details/" + projectId);
        }
        private PartialViewResult ShowOverview(int projectId)
        {
            OverviewModel model;

            int userId = int.Parse(User.Identity.GetProjectUserId());

            var managerTask = new TaskManager();
            var managerProject = new ProjectUserManager();
            var tasks = managerTask.GetTasksForProject(projectId);

            ViewData["isLeader"] = managerProject.IsLeader(userId, projectId);

            int tasksDone = tasks.Where(t => t.State == managerTask.GetDoneStateId()).Count();
            int tasksActive = tasks.Where(t => t.State == managerTask.GetActiveStateId()).Count();
            int tasksUnassigned = managerTask.GetUnassignedTasks(projectId).Count();
            double workHours = managerTask.GetAllWorkTimeForProject(projectId)
                .Sum(w => w.EndTime.Subtract(w.StartTime).TotalSeconds);

            var users = managerProject.GetUsersForProject(projectId);
            List<string> devs = new List<string>();
            foreach (var u in users)
            {
                devs.Add(u.UserName);
            }

            var project = managerProject.GetProject(projectId);

            var projectLeaderName = managerProject.GetProjectLeader(projectId).UserName;

            model = new OverviewModel(
                project, devs,
                tasksDone, tasksActive, tasksUnassigned,
                (int)(workHours / 3600), projectLeaderName);

            return PartialView("_Overview", model);
        }
        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);
        }