Exemplo n.º 1
0
        public async Task <List <DIBZ.Common.Model.Notification> > AddNotifications(NotificationModel request)
        {
            List <DIBZ.Common.Model.Notification> notifications = new List <Common.Model.Notification>();

            foreach (var offerId in request.OfferIds)
            {
                DIBZ.Common.Model.Notification notification = new DIBZ.Common.Model.Notification();
                notification.Content = request.Content;
                notification.Title   = request.Title;

                notification.Channel                  = request.Channel;
                notification.AppUserId                = request.AppUserId;
                notification.AdditionalData           = request.AdditionalData;
                notification.IsActive                 = true;
                notification.IsDeleted                = false;
                notification.LastError                = request.LastError;
                notification.OfferId                  = offerId;
                notification.Status                   = request.Status;
                notification.NotificationType         = request.NotificationType;
                notification.NotificationBusinessType = request.NotificationBusinessType;
                notification.CreatedTime              = request.CreatedTime;
                notifications.Add(notification);
            }
            Db.AddAll(notifications);
            await Db.SaveAsync();

            return(notifications);
        }