Exemple #1
0
        public override string ToHtmlString()
        {
            var teamMembers = predicate == null?teamMemberService.GetTeamMembers()
                                  : teamMemberService.GetTeamMembers().Where(this.predicate);

            if (this._displayCount.HasValue && this._displayCount.Value > 0)
            {
                teamMembers = teamMembers.Take(this._displayCount.Value);
            }

            foreach (var item in teamMembers)
            {
                var teamMemberItem = new TeamMemberItem();
                teamMemberItem.Name           = item.FullName;
                teamMemberItem.Position       = item.Position;
                teamMemberItem.Image          = mediaStorageService.GetPictureUrl(item.PictureId);
                teamMemberItem.SocialNetworks = socialNetworkService.GetByEntity(item.Id, nameof(TeamMember)).ToList();
                if (teamMemberItem.SocialNetworks == null)
                {
                    teamMemberItem.SocialNetworks = new List <SocialNetwork>();
                }
                this.Component.Items.Add(teamMemberItem);
            }

            return(base.ToHtmlString());
        }
Exemple #2
0
        public ApplicationUser GetById(string userId)
        {
            var user = userService.FindByIdAsync(userId).Result;

            if (user != null)
            {
                user.Avatar = cacheManager.Get(CacheConstant.MEDIA_STORAGE_ITEM.FormatInvariant(user.PictureId), () =>
                {
                    return(mediaStorageService.GetById(user.PictureId));
                });
                user.SocialNetworks = cacheManager.Get(CacheConstant.SOCIAL_NETWORK_ITEM.FormatInvariant(user.Id), () =>
                {
                    return(socialNetworkService.GetByEntity(user.Id, nameof(ApplicationUser)).ToList());
                });
            }

            return(user);
        }
Exemple #3
0
        public ActionResult SocialNetworkList(GridCommand command, string entityId)
        {
            var modelList = new List <SocialNetworkModel>();
            var list      = socialNetworkService.GetByEntity(entityId, nameof(ApplicationUser));

            foreach (var item in list)
            {
                modelList.Add(new SocialNetworkModel()
                {
                    EntityId   = item.EntityId,
                    Id         = item.Id,
                    Name       = item.Name,
                    WebAddress = item.WebAddress,
                    OrderNo    = item.OrderNo,
                    IsActive   = item.IsActive
                });
            }
            return(new JsonResult {
                Data = modelList
            });
        }