本文整理汇总了C#中ICommentService.GetTop20CommentsOfPublicGoals方法的典型用法代码示例。如果您正苦于以下问题:C# ICommentService.GetTop20CommentsOfPublicGoals方法的具体用法?C# ICommentService.GetTop20CommentsOfPublicGoals怎么用?C# ICommentService.GetTop20CommentsOfPublicGoals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICommentService
的用法示例。
在下文中一共展示了ICommentService.GetTop20CommentsOfPublicGoals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProfileNotifications
internal IEnumerable<NotificationsViewModel> GetProfileNotifications(string userid, IGoalService goalService, ICommentService commentService, IUpdateService updateService, ISupportService supportService, IUserService userService, IGroupService groupService, IGroupUserService groupUserSevice, IGroupGoalService groupGoalService, IGroupCommentService groupcommentService, IGroupUpdateService groupupdateService, ICommentUserService commentUserService)
{
var goals = goalService.GetTop20Goals(userid);
var comments = commentService.GetTop20CommentsOfPublicGoals(userid);
var updates = updateService.GetTop20Updates(userid);
var groupusers = groupUserSevice.GetTop20GroupsUsersForProfile(userid);
var supports = supportService.GetTop20Support(userid);
return (from g in goals
select new NotificationsViewModel()
{
GoalId = g.GoalId,
UserId = g.UserId,
CreatedDate = g.CreatedDate,
UserName = g.User.UserName,
GoalName = g.GoalName,
Desc = g.Desc,
ProfilePicUrl = g.User.ProfilePicUrl,
Goal = g,
NotificationDate = DateCalculation(g.CreatedDate),
NotificationType = (int)NotificationType.createdGoal
})
.Concat(from c in comments
select new NotificationsViewModel()
{
CommentId = c.CommentId,
CreatedDate = c.CommentDate,
UserName = commentUserService.GetUser(c.CommentId).UserName,
UserId = commentUserService.GetUser(c.CommentId).Id,
ProfilePicUrl = commentUserService.GetUser(c.CommentId).ProfilePicUrl,
CommentText = c.CommentText,
UpdateId = c.UpdateId,
GoalName = c.Update.Goal.GoalName,
GoalId = c.Update.GoalId,
NumberOfComments = commentService.GetCommentsByUpdate(c.UpdateId).Count(),
Updatemsg = updateService.GetUpdate(c.UpdateId).Updatemsg,
NotificationDate = DateCalculation(c.CommentDate),
NotificationType = (int)NotificationType.commentedOnUpdate
})
.Concat(from u in updates
select new NotificationsViewModel()
{
Update = u,
UpdateId = u.UpdateId,
GoalId = u.GoalId,
ProfilePicUrl = u.Goal.User.ProfilePicUrl,
GoalName = u.Goal.GoalName,
Updatemsg = u.Updatemsg,
UserId = u.Goal.UserId,
UserName = u.Goal.User.UserName,
NumberOfComments = commentService.GetCommentsByUpdate(u.UpdateId).Count(),
CreatedDate = u.UpdateDate,
NotificationDate = DateCalculation(u.UpdateDate),
NotificationType = (int)NotificationType.updatedGoal
})
.Concat(from s in supports
select new NotificationsViewModel()
{
Support = s,
SupportId = s.SupportId,
GoalName = s.Goal.GoalName,
ProfilePicUrl = userService.GetUser(s.UserId).ProfilePicUrl,
UserName = userService.GetUser(s.UserId).UserName,
UserId = s.UserId,
CreatedDate = s.SupportedDate,
GoalId = s.GoalId,
NotificationType = (int)NotificationType.supportGoal
})
.Concat(from gu in groupusers
select new NotificationsViewModel()
{
GroupUser = gu,
GroupUserId = gu.GroupUserId,
UserName = userService.GetUser(gu.UserId).UserName,
ProfilePicUrl = userService.GetUser(gu.UserId).ProfilePicUrl,
UserId = gu.UserId,
GroupName = groupService.GetGroup(gu.GroupId).GroupName,
GroupId = gu.GroupId,
CreatedDate = gu.AddedDate,
NotificationDate = DateCalculation(gu.AddedDate),
NotificationType = (int)NotificationType.joinGroup
})
.OrderByDescending(n => n.CreatedDate);
}