diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index 167403e8..6bb52d97 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -83,10 +83,15 @@ namespace AyaNova.Biz } - //check subscriptions for event and send accordingly - var subs = ct.NotifySubscription.Where(z => z.EventType == eventType) - - + //check subscriptions for event and send accordingly to each user + var subs = await ct.NotifySubscription.Where(z => z.EventType == eventType).ToListAsync(); + foreach (var sub in subs) + { + NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, SubscriptionId = sub.Id }; + await ct.NotifyEvent.AddAsync(n); + } + if (subs.Count > 0) + await ct.SaveChangesAsync(); } }