Exemplo n.º 1
0
        public ActionResult AssignToProject(PListViewModel selectedusers, int Projectid)
        {
            var nHelper = new UserNotificationsHelper();

            ViewBag.Notifications = nHelper.filterNotifications(User.Identity.GetUserId());
            var Helper = new UserProjetsHelper();

            foreach (var id in selectedusers.SelectednonPUsers)
            {
                if (id != null)
                {
                    Helper.AddUserToProject(id, Projectid);
                }
            }
            List <SelectListItem> listOfUsersOnProject    = new List <SelectListItem>();
            List <SelectListItem> listOfUsersNotOnProject = new List <SelectListItem>();
            var zHelper           = new UserProjetsHelper();
            var usersOnProject    = zHelper.UsersOnProject(Projectid, "Developer");
            var usersNotOnProject = zHelper.UsersNotOnProject(Projectid, "Developer");

            //var listOfUsersOnProject = new MultiSelectList(usersOnProject, "Id", "DisplayName");
            //var listOfUsersNotOnProject = new MultiSelectList(usersNotOnProject, "Id", "DisplayName");
            foreach (var user in usersOnProject)
            {
                SelectListItem selectList = new SelectListItem()
                {
                    Text  = user.DispalyName,
                    Value = user.Id
                };
                listOfUsersOnProject.Add(selectList);
            }
            foreach (var user in usersNotOnProject)
            {
                SelectListItem selectList = new SelectListItem()
                {
                    Text  = user.DispalyName,
                    Value = user.Id
                };
                listOfUsersNotOnProject.Add(selectList);
            }
            PListViewModel LViewModel = new PListViewModel()
            {
                zUsers     = listOfUsersOnProject,
                otherUsers = listOfUsersNotOnProject,
                Title      = db.Projects.Find(Projectid)
            };

            return(View("Details", LViewModel));
        }
Exemplo n.º 2
0
        public ActionResult Details(int?id)
        {
            var nHelper = new UserNotificationsHelper();

            ViewBag.Notifications = nHelper.filterNotifications(User.Identity.GetUserId());
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            List <SelectListItem> listOfUsersOnProject    = new List <SelectListItem>();
            List <SelectListItem> listOfUsersNotOnProject = new List <SelectListItem>();
            var zHelper           = new UserProjetsHelper();
            var usersOnProject    = zHelper.UsersOnProject((int)id, "Developer");
            var usersNotOnProject = zHelper.UsersNotOnProject((int)id, "Developer");

            //var listOfUsersOnProject = new MultiSelectList(usersOnProject, "Id", "DisplayName");
            //var listOfUsersNotOnProject = new MultiSelectList(usersNotOnProject, "Id", "DisplayName");
            foreach (var user in usersOnProject)
            {
                SelectListItem selectList = new SelectListItem()
                {
                    Text  = user.DispalyName,
                    Value = user.Id
                };
                listOfUsersOnProject.Add(selectList);
            }
            foreach (var user in usersNotOnProject)
            {
                SelectListItem selectList = new SelectListItem()
                {
                    Text  = user.DispalyName,
                    Value = user.Id
                };
                listOfUsersNotOnProject.Add(selectList);
            }
            PListViewModel LViewModel = new PListViewModel()
            {
                zUsers     = listOfUsersOnProject,
                otherUsers = listOfUsersNotOnProject,
                Title      = db.Projects.Find(id)
            };

            return(View(LViewModel));
        }