Exemplo n.º 1
0
        public async Task <IViewComponentResult> InvokeForSiteAsync(string siteId)
        {
            var groups = await _userGroupManager.GetPublicUserGroupsForSiteAsync(siteId, Models.UserGroupType.NotificationGroup);

            var model = new List <UserMembershipViewModel>();

            foreach (var group in groups)
            {
                model.Add(new UserMembershipViewModel()
                {
                    UserGroupId           = group.Id,
                    UserGroupName         = group.Name,
                    AllowPublicEnrollment = true,
                    AllowEmailMessaging   = false,
                    AllowSmsMessaging     = false,
                    IsMember = false
                });
            }
            model = model.OrderBy(m => m.UserGroupName).ToList();

            ViewData["userId"] = string.Empty;
            ViewData["siteId"] = siteId;

            return(View("NotifyMeViewList", model));
        }