Example #1
0
        public virtual async Task HandleUserInfoGet(
            ISiteContext site,
            SiteUser siteUser,
            UserInfoViewModel viewModel,
            HttpContext httpContext,
            ViewDataDictionary viewData,
            CancellationToken cancellationToken = default(CancellationToken)
            )
        {
            await EnsureProps();

            // add user props to viewData to pass them to the view
            var userProps = await _userPropertyService.FetchByUser(site.Id.ToString(), siteUser.Id.ToString());

            foreach (var p in _props.Properties)
            {
                if (p.VisibleToUserOnProfile)
                {
                    if (_userPropertyService.IsNativeUserProperty(p.Key))
                    {
                        viewData[p.Key] = _userPropertyService.GetNativeUserProperty(siteUser, p.Key);
                    }
                    else
                    {
                        var found = userProps.Where(x => x.Key == p.Key).FirstOrDefault();
                        if (found != null)
                        {
                            viewData[p.Key] = found.Value;
                        }
                    }
                }
            }
        }