Created
August 10, 2011 19:33
-
-
Save mstarkman/1137911 to your computer and use it in GitHub Desktop.
Social_GetNotificationCounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
using Fishidy.Domain.SqlServerStructures.Models.Persistence; | |
using Fishidy.Domain.SqlServerStructures.Models.Processing; | |
namespace Fishidy.Domain.SqlServerStructures.StoredProcedures | |
{ | |
public class Social_GetNotificationCounts | |
{ | |
public static List<Social_GetNotificationCountsResult> Execute(Guid? sourceNodeID) | |
{ | |
var results = new List<Social_GetNotificationCountsResult>(); | |
var notifications = FishidySqlMongo<NotificationTable>.AsQueryable.Where(n => n.TargetNodeID == sourceNodeID).ToList(); | |
notifications | |
.GroupBy(n => n.RelationshipType, n => 1) | |
.ToList() | |
.ForEach(n => results.Add(new Social_GetNotificationCountsResult | |
{ | |
RelationshipType = n.Key, | |
count = n.Sum() | |
})); | |
return results; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment