コード例 #1
0
        // GET: Employee
        public ActionResult Index(int p)
        {
            IEnumerable <Employee2> emp2 = new List <Employee2>();
            Employee2 emp3 = new Employee2();

            if (p == 0)
            {
                Employee emp = new Employee();

                ViewBag.NameList = (from n in _stateRepo.GetNameList() select new SelectListItem {
                    Text = n.Name, Value = n.Id.ToString()
                }).ToList();
                emp2             = _stateRepo.GetList();
                ViewBag.first    = 0;
                return(View(emp2));
            }
            else
            {
                ViewBag.NameList = (from n in _stateRepo.GetNameList() select new SelectListItem {
                    Text = n.Name, Value = n.Id.ToString()
                }).ToList();
                emp2             = _stateRepo.GetListSingle(p);
                ViewBag.first    = 1;
                return(View(emp2));
            }
        }