This commit is contained in:
@@ -79,7 +79,16 @@ namespace AyaNova.Biz
|
||||
|
||||
var UserName = await ct.User.Where(z => z.Id == userId).Select(z => z.Name).FirstOrDefaultAsync();
|
||||
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = 0, Name = UserName };
|
||||
//if they don't have a regular inapp subscription create one now
|
||||
var defaultsub = await ct.NotifySubscription.FirstOrDefaultAsync(z => z.EventType == NotifyEventType.GeneralNotification && z.UserId == userId && z.DeliveryMethod == NotifyDeliveryMethod.App);
|
||||
if (defaultsub == null)
|
||||
{
|
||||
defaultsub = new NotifySubscription() { UserId = userId, EventType = NotifyEventType.GeneralNotification, DeliveryMethod = NotifyDeliveryMethod.App };
|
||||
await ct.NotifySubscription.AddAsync(defaultsub);
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = defaultsub.Id, Name = UserName };
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
await ct.SaveChangesAsync();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user