Exemplo n.º 1
0
        public async Task AddNotificationTransport(NotificationTransport transport)
        {
            DeleteOldNotificationTransports(transport.GetType(), transport.UserId);

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

            await db.SaveChangesAsync();
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
            }
        }