public ActionResult AssignUserProjects(int id)
        {
            var project = db.Projects.Find(id);
            var model = new ProjectUserViewModels { ProjectId = id, ProjectName = project.Name };
            var userProjectList = helper.ListDevelopersNotAssigned(id);

            model.Users = new MultiSelectList(userProjectList.OrderBy(m => m.DisplayName), "id", "DisplayName", null);

            return View(model);
        }
        public ActionResult AssignPmProjects(int id)
        {
            var project = db.Projects.Find(id);
            var model = new ProjectUserViewModels { ProjectId = id, ProjectName = project.Name };
            var userProjectList = helper.ListPManagerNotAssigned(id);
            var pm = helper.ListProjectManagers(id);

            if (pm == null)
            {
                model.ProjectManager = "Unassigned";
            }
            else
            {
                model.ProjectManager = pm.DisplayName;
            }

            model.Users = new SelectList(userProjectList.OrderBy(m => m.DisplayName), "Id", "DisplayName", null);

            return View(model);
        }
 public ActionResult AssignPmProjects(ProjectUserViewModels model)
 {
     if (ModelState.IsValid)
     {
         if (model.SelectedUsers != null)
         {
             foreach (string userId in model.SelectedUsers)
             {
                 var temp = helper.ListProjectManagers(model.ProjectId);
                 if(temp != null)
                 {
                 helper.RemovePmFromProject(temp.Id, model.ProjectId);
                 }
                 helper.AssignUserToProject(model.SelectedUsers[0], model.ProjectId);
             }
         }
         return RedirectToAction("Index", "ProjectManager");
     }
     return View(model);
 }
 public ActionResult AssignUserProjects(ProjectUserViewModels model)
 {
     if (ModelState.IsValid)
     {
         if (model.SelectedUsers != null)
         {
             foreach (string userId in model.SelectedUsers)
             {
                 helper.AssignUserToProject(userId, model.ProjectId);
             }
         }
         return RedirectToAction("Index", "ProjectManager");
     }
     return View(model);
 }
 public ActionResult RemoveUserProjects(ProjectUserViewModels model)
 {
     if (ModelState.IsValid)
     {
         if (model.SelectedUsers != null)
         {
             foreach (string id in model.SelectedUsers)
             {
                 helper.RemoveUserFromProject(id, model.ProjectId);
             }
         }
         return RedirectToAction("Index", "ProjectManager");
     }
     return View(model);
 }