Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IViewComponentResult> InvokeAsync(string userGroupId, string poolId)
        {
            if (string.IsNullOrEmpty(userGroupId))
            {
                return(new ViewComponentPlaceholder());
            }

            var group = await _userGroupManager.GetUserGroupAsync(userGroupId);

            if (group == null)
            {
                return(new ViewComponentPlaceholder());
            }

            var model = new UserGroupMembershipViewModel()
            {
                UserGroupId         = userGroupId,
                AccessLevel         = AccessLevel.Audience,
                AllowEmailMessaging = false,
                AllowSmsMessaging   = false
            };

            if (group.UserGroupType == UserGroupType.NotificationGroup)
            {
                model.AllowEmailMessaging = true;
                model.AllowSmsMessaging   = true;
            }

            ViewData["ShowAllowMessagingCheckbox"] = true;  //(group.UserGroupType != UserGroupType.NotificationGroup);
            ViewData["AccessLevelSelectList"]      = _enumLocalizer.GetSelectList <AccessLevel>();
            ViewData["PoolId"] = poolId;

            return(View("UserGroupMemberCreate", model));
        }
        protected async Task <IViewComponentResult> InvokeEditAsync(string id)
        {
            var userGroup = await _userGroupManager.GetUserGroupAsync(id);

            if (userGroup == null)
            {
                return(new ViewComponentPlaceholder());
            }
            var model = userGroup.ProjectTo <UserGroupViewModel>();

            ViewData["ShowOpenEnrollmentCheckbox"] = true;  //(model.UserGroupType == UserGroupType.ConnectionGroup);

            ViewData["isCreate"] = false;
            return(View("UserGroupDetailsEdit", model));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IViewComponentResult> InvokeAsync(string userGroupId, string userId)
        {
            if (string.IsNullOrEmpty(userGroupId) || string.IsNullOrEmpty(userId))
            {
                return(new ViewComponentPlaceholder());
            }

            var model = new UserGroupMembershipViewModel()
            {
                UserGroupId = userGroupId,
                UserId      = userId
            };

            var group = await _userGroupManager.GetUserGroupAsync(model.UserGroupId);

            if (group == null)
            {
                return(new ViewComponentPlaceholder());
            }

            var member = await _userGroupManager.GetUserGroupMembershipAsync(model.UserGroupId, model.UserId);

            if (member == null)
            {
                return(new ViewComponentPlaceholder());
            }

            var user = await _userManager.GetUserAsync(model.UserId);

            if (user == null)
            {
                return(new ViewComponentPlaceholder());
            }

            model.AccessLevel         = member.AccessLevel;
            model.AllowEmailMessaging = member.AllowEmailMessaging;
            model.AllowSmsMessaging   = member.AllowSmsMessaging;
            model.UserName            = user.UserName;
            model.Email                = user.Email;
            model.EmailConfirmed       = user.EmailConfirmed;
            model.PhoneNumber          = user.PhoneNumber;
            model.PhoneNumberConfirmed = user.PhoneNumberConfirmed;

            ViewData["ShowAllowMessagingCheckbox"] = true;
            ViewData["AccessLevelSelectList"]      = _enumLocalizer.GetSelectList <AccessLevel>();

            return(View("UserGroupMemberEdit", model));
        }
Beispiel #4
0
        public async Task <IViewComponentResult> InvokeAsync(string Id = "")
        {
            if (string.IsNullOrEmpty(Id))
            {
                return(new ViewComponentPlaceholder());
            }

            var group = await _userGroupManager.GetUserGroupAsync(Id);

            if (group == null)
            {
                return(new ViewComponentPlaceholder());
            }

            ViewData["hideLevelColumn"]   = false;
            ViewData["hideMessageColumn"] = (group.UserGroupType == UserGroupType.NotificationGroup);
            ViewData["userGroupId"]       = Id;
            return(View("UserGroupMemberList"));
        }