Example #1
0
        public async Task AddNotificationTransport(NotificationTransport transport)
        {
            DeleteOldNotificationTransports(transport.GetType(), transport.UserId);

            transport.IsDeleted = false;
            db.NotificationTransports.Add(transport);

            await db.SaveChangesAsync();
        }
Example #2
0
        public async Task AddNotificationTransport(NotificationTransport transport)
        {
            using (var transaction = db.Database.BeginTransaction())
            {
                await DeleteOldNotificationTransports(transport.GetType(), transport.UserId);

                transport.IsDeleted = false;
                db.NotificationTransports.Add(transport);

                await db.SaveChangesAsync();

                await transaction.CommitAsync();
            }
        }
Example #3
0
        public async Task AddNotificationTransport(NotificationTransport transport)
        {
            using (var transaction = db.Database.BeginTransaction())
            {
                DeleteOldNotificationTransports(transport.GetType(), transport.UserId);

                /*
                 * if (transport is MailNotificationTransport)
                 *      DeleteOldNotificationTransports<MailNotificationTransport>(transport.UserId);
                 * if (transport is TelegramNotificationTransport)
                 *      DeleteOldNotificationTransports<TelegramNotificationTransport>(transport.UserId);
                 */

                transport.IsDeleted = false;
                db.NotificationTransports.Add(transport);

                await db.SaveChangesAsync().ConfigureAwait(false);

                transaction.Commit();
            }
        }