コード例 #1
0
ファイル: groupsController.cs プロジェクト: mlseck/Cronus
        //
        // GET: /Group/Edit/5

        public ActionResult Edit(int GroupID)
        {
            ViewBag.PossibleProjects = projectRepository.All;

            ViewBag.PossibleEmployees = employeeRepository.All;

            group model = groupRepository.FindGroup(GroupID);

            employee manager = employeeRepository.Find(model.groupManager);

            var managers = groupRepository.All.Select(g => g.groupManager).ToList();

            List <employee> availableManagerList = employeeRepository.All.Select(e => e).Where(e => !managers.Contains(e.employeeID)).ToList();

            availableManagerList.Add(manager);

            model.empList = availableManagerList.ConvertAll(a =>
            {
                return(new SelectListItem()
                {
                    Text = a.employeeLastName.ToString(),
                    Value = a.employeeID.ToString(),
                });
            });

            model.empList.First(x => x.Value == model.groupManager).Selected = true;

            model.projectIds = (from s in model.projects select s.projectID).ToArray();

            model.employeeIds = (from s in model.employees select s.employeeID).ToArray();

            return(View(model));
        }
コード例 #2
0
        //
        // GET: /employee/Details/5

        public ViewResult Details(string id)
        {
            return(View(employeeRepository.Find(id)));
        }