コード例 #1
0
ファイル: UserController.cs プロジェクト: ideayapai/docviewer
        //[MenuHightlight(CurrentItem = "user_tt", CurrentParentItem = "user_home")]
        public ActionResult Create()
        {
            var roleExpression = new[]
            {
                new ExpressionCriteria{ PropertyName = "IsDel", Value = 0, Operate = Operator.Equal },
            };
            var roles = _roleService.Get(roleExpression, properties: new[] { "Id", "Name" }).Select(p => new SelectListItem
            {
                Text = p.Name,
                Value = p.Id.ToString(),
            }).ToList();
            //var roles = _roleService.GetByUser(CurrentUser.UserName, properties: new[] { "Id", "Name" }).Select(p => new SelectListItem
            //{
            //    Text = p.Name,
            //    Value = p.Id.ToString(),
            //}).ToList();
            ViewData["Roles"] = roles;

            var deptExpression = new[]
            {
                new ExpressionCriteria{ PropertyName = "DEPT_INFO_ISDEL", Value = 0, Operate = Operator.Equal },
            };

            var departs = _departmentService.Get(deptExpression, properties: new[] {"Id", "Name"}).Select(p => new SelectListItem
                {
                    Text = p.Name,
                    Value = p.Id.ToString(),
                }).ToList();
            //var departs = _departmentService.GetByUser(CurrentUser.UserName, properties: new[] { "Id", "Name" }).Select(p => new SelectListItem
            //{
            //    Text = p.Name,
            //    Value = p.Id.ToString(),
            //}).ToList();
            ViewData["Departments"] = departs;

            var item = new UserContract()
            {
                Id = Guid.NewGuid(),
                CreatedBy = CurrentUser.UserName
            };
            return View(new UserViewModel(item));
        }
コード例 #2
0
ファイル: UserViewModel.cs プロジェクト: ideayapai/docviewer
 public UserViewModel(UserContract contract)
 {
     UserContract = contract;
 }