예제 #1
0
 public void AssignUserToProject(ProjectUserViewModel model)
 {
     Project project = FindProject(model.Project.Id);
     project.Users.Clear();
     project.Users = db.Users.Where(u => model.SelectedUsers.Contains(u.Id)).ToList();
     db.SaveChanges();
 }
예제 #2
0
 public ActionResult Edit(ProjectUserViewModel model)
 {
     db.Projects.Attach(model.Project);
     db.Entry(model.Project).Property("Name").IsModified = true;
     db.SaveChanges();
     return RedirectToAction("Edit", new { Id = model.Project.Id });
 }
예제 #3
0
        public ActionResult Edit(int? Id)
        {
            UserRoleHelper helper = new UserRoleHelper();
            var pms = helper.UsersInRole("Project Manager");
            var devs = helper.UsersInRole("Developer");
            var project = db.Projects.Find(Id);
            var model = new ProjectUserViewModel()
            {
                Project = project,
               Pms = new MultiSelectList(pms, "Id", "UserName", project.Users.Select(u => u.Id)),
                Devs = new MultiSelectList(devs, "Id", "UserName", project.Users.Select(u => u.Id)),
                Ticket = null,

            };
            return View(model);
        }
예제 #4
0
 public ActionResult AssignPm(ProjectUserViewModel model)
 {
     PHelper.AssignUserToProject(model);
     return RedirectToAction("Edit", new{Id = model.Project.Id });
 }