/// <summary> /// 最新加入 /// </summary> /// <param name="spaceKey">群组标识</param> /// <param name="topNumber">前几条数据</param> /// <returns></returns> public ActionResult _ListMembers(string spaceKey, int topNumber) { long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey); IUser currentUser = UserContext.CurrentUser; if (currentUser == null) { return(new EmptyResult()); } PagingDataSet <GroupMember> groupMembers = groupService.GetGroupMembers(groupId, false, SortBy_GroupMember.DateCreated_Desc); IEnumerable <GroupMember> members = groupMembers.Take(topNumber); //设置当前登录用户对当前页用户的关注情况 Dictionary <long, bool> isCurrentUserFollowDic = new Dictionary <long, bool>(); foreach (var member in members) { if (followService.IsFollowed(currentUser.UserId, member.UserId)) { isCurrentUserFollowDic[member.UserId] = true; } else { isCurrentUserFollowDic[member.UserId] = false; } } ViewData["isCurrentUserFollowDic"] = isCurrentUserFollowDic; return(View(members)); }
public ActionResult _CreateBlogThread(long ActivityId) { Activity activity = activityService.Get(ActivityId); if (activity == null) { return(Content(string.Empty)); } BlogThread thread = blogService.Get(activity.SourceId); if (thread == null) { return(Content(string.Empty)); } PagingDataSet <Comment> comments = commentService.GetRootComments(TenantTypeIds.Instance().BlogThread(), thread.ThreadId, 1, SortBy_Comment.DateCreatedDesc); ViewData["Comments"] = comments.Take(3); //ViewData["Comments"] = commentService.GetTopComments(thread.ThreadId, TenantTypeIds.Instance().BlogThread(), 3, SortBy_Comment.DateCreatedDesc); IEnumerable <Attachment> attachments = attachementService.GetsByAssociateId(thread.ThreadId); if (attachments != null && attachments.Count() > 0) { IEnumerable <Attachment> attachmentImages = attachments.Where(n => n.MediaType == MediaType.Image); if (attachmentImages != null && attachmentImages.Count() > 0) { ViewData["Attachments"] = attachmentImages; } } ViewData["ActivityId"] = ActivityId; return(View(thread)); }
/// <summary> /// 最新加入 /// </summary> /// <param name="spaceKey">群组标识</param> /// <param name="topNumber">前几条数据</param> /// <returns></returns> public ActionResult _ListMembers(string spaceKey, int topNumber) { long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey); IUser currentUser = UserContext.CurrentUser; if (currentUser == null) { return(new EmptyResult()); } PagingDataSet <GroupMember> groupMembers = groupService.GetGroupMembers(groupId, false, SortBy_GroupMember.DateCreated_Desc); IEnumerable <GroupMember> members = groupMembers.Take(topNumber); return(View(members)); }
/// <summary> /// 最新加入 /// </summary> /// <param name="spaceKey">专题标识</param> /// <param name="topNumber">前几条数据</param> /// <returns></returns> public ActionResult _ListMembers(string spaceKey, int topNumber) { long topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IUser currentUser = UserContext.CurrentUser; if (currentUser == null) { return(new EmptyResult()); } PagingDataSet <TopicMember> topicMembers = topicService.GetTopicMembers(topicId, false, SortBy_TopicMember.DateCreated_Desc); IEnumerable <TopicMember> members = topicMembers.Take(topNumber); return(View(members)); }
public ActionResult _CreateBarThread(long ActivityId) { Activity activity = activityService.Get(ActivityId); if (activity == null) { return(Content(string.Empty)); } BarThread thread = barThreadService.Get(activity.SourceId); if (thread == null) { return(Content(string.Empty)); } PagingDataSet <BarPost> barPosts = barPostService.Gets(thread.ThreadId, false, SortBy_BarPost.DateCreated_Desc); ViewData["BarPosts"] = barPosts.Take(3); IEnumerable <Attachment> attachments = attachementService.GetsByAssociateId(thread.ThreadId); if (attachments != null && attachments.Count() > 0) { IEnumerable <Attachment> attachmentImages = attachments.Where(n => n.MediaType == MediaType.Image); if (attachmentImages != null && attachmentImages.Count() > 0) { ViewData["Attachments"] = attachmentImages; } } ViewData["ActivityId"] = ActivityId; if (thread.BarSection.TenantTypeId != TenantTypeIds.Instance().Bar()) { var tenantType = new TenantTypeService().Get(thread.BarSection.TenantTypeId); string tenantTypeName = string.Empty; if (tenantType != null) { tenantTypeName = tenantType.Name; } ViewData["tenantTypeName"] = tenantTypeName; } return(View(thread)); }