示例#1
0
        //生成界面显示数据
        private void GenerateViewData()
        {
            //技术类别
            //Text是界面显示的,Value是与后端交互的
            List <SelectListItem> selectListItems = new List <SelectListItem>();

            selectListItems.Add(new SelectListItem("硬件工程师", "硬件工程师"));
            selectListItems.Add(new SelectListItem("基带工程师", "基带工程师"));
            selectListItems.Add(new SelectListItem("嵌入式工程师", "嵌入式工程师"));
            selectListItems.Add(new SelectListItem("软件工程师", "软件工程师"));
            selectListItems.Add(new SelectListItem("其他", "其他"));
            ViewData["PostTypes"] = selectListItems;
            //部门
            selectListItems = new List <SelectListItem>();
            var departments = _departmentAppService.GetAllDtos();

            foreach (var tem in departments)
            {
                selectListItems.Add(new SelectListItem(tem.Name, tem.Name.ToString()));
            }
            ViewData["Departments"] = selectListItems;
            //角色
            selectListItems = new List <SelectListItem>();
            var roles = _roleAppService.GetAllDtos();

            foreach (var tem in roles)
            {
                selectListItems.Add(new SelectListItem(tem.Name, tem.Name.ToString()));
            }
            ViewData["Roles"] = selectListItems;
        }
        //主界面
        public IActionResult Index(int Page = 1, int PageSize = 5)
        {
            //ViewBag.User = HttpContext.Session.GetString("CurrentUser");
            ViewBag.PageSize = PageSize;//记录每页显示数
            var departmentList = _departmentAppService.GetAllDtos();

            return(View(departmentList.ToPagedList(Page, PageSize)));
        }