コード例 #1
0
        public ActionResult AssignUserToProject(int projectId)
        {
            var project = ProjectHelper.GetProject(projectId);

            if (project == null)
            {
                return(HttpNotFound());
            }
            var users = ProjectHelper.UsersOutOfTheProject(projectId);

            ViewBag.ProjectId   = projectId;
            ViewBag.ProjectName = project.Name;
            ViewBag.UserId      = new SelectList(users, "Id", "UserName");
            return(View());
        }
コード例 #2
0
        public ActionResult AssignUserToProject(string Id, int projectId)
        {
            var project = ProjectHelper.GetProject(projectId);

            if (project == null)
            {
                return(HttpNotFound());
            }

            if (ProjectHelper.AssignUserToProject(Id, projectId))
            {
                return(RedirectToAction("ShowAllUsers", new { projectId }));
            }

            var users = ProjectHelper.UsersOutOfTheProject(projectId);

            ViewBag.ProjectId   = projectId;
            ViewBag.ProjectName = project.Name;
            ViewBag.UserId      = new SelectList(users, "Id", "UserName");

            return(RedirectToAction("ShowAllUsers", new { projectId }));
        }