Esempio n. 1
0
        /// <summary>
        /// 列出用户所属角色
        /// </summary>
        /// <param name="Id">用户Id</param>
        /// <returns></returns>
        public async Task <IActionResult> ListByUserId(string Id)
        {
            var linqVar = from p in _userRoleRepository.EntityItems
                          join q in _roleRepository.EntityItems
                          on p.RoleId equals q.Id
                          where p.UserId == Id
                          select new UserRoleViewModel
            {
                RoleName = q.Name
            };

            var re = _userRepository.EntityItems.Where(p => p.Id == Id)
                     .Select(p => new { p.Email, p.UserName, p.StaffName }).FirstOrDefault();

            var model = new UserRoleListViewModel
            {
                UserId             = Id,
                Email              = re.Email,
                UserName           = re.UserName,
                StaffName          = re.StaffName,
                UserRoleViewModels = linqVar.ToList(),
            };

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            UserRoleListViewModel userRoleListViewModel = new UserRoleListViewModel
            {
                UserRoleItemList = _userRoleService.GetAllItems()
            };

            return(View(userRoleListViewModel));
        }
Esempio n. 3
0
        public async Task <IActionResult> Index(Guid application)
        {
            var model = new UserRoleListViewModel()
            {
                Application  = application,
                Applications = await Registry.GetApplications(),
                UserRoles    = await Server.GetUserRoles(application)
            };

            return(View(model));
        }
Esempio n. 4
0
        protected override void OnInitialization()
        {
            _regionManager.RegisterViewWithRegion(RegionNames.RightUserRegion, typeof(LoggedInUserView));

            EventServiceFactory.EventService.GetEvent<GenericEvent<string>>().Subscribe(x =>
            {
                if (x.Topic == EventTopicNames.PinSubmitted)
                    PinEntered(x.Value);
            });

            EventServiceFactory.EventService.GetEvent<GenericEvent<VisibleViewModelBase>>().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _userListViewModel)
                        _userListViewModel = null;

                    if (s.Value == _userRolesListViewModel)
                        _userRolesListViewModel = null;
                }
            });
        }
Esempio n. 5
0
 public void OnListRoles(string value)
 {
     if (_userRolesListViewModel == null)
         _userRolesListViewModel = new UserRoleListViewModel();
     CommonEventPublisher.PublishViewAddedEvent(_userRolesListViewModel);
 }