public void UpdateNotificationSetting(NotificationSetting notificationSetting)
        {
            Require.NotNull(notificationSetting, nameof(notificationSetting));

            var session = _sessionProvider.GetCurrentSession();
            session.Update(notificationSetting);
        }
        public void UpdateNotificationSetting(NotificationSetting notificationSetting)
        {
            Require.NotNull(notificationSetting, nameof(notificationSetting));

            var oldNotificationSetting = _notificationSettingsRepository.ReadNotificationSettingByCriteria(
                setting => setting.UserId == notificationSetting.UserId
                           && setting.NotificationType == notificationSetting.NotificationType);
            if (oldNotificationSetting != null)
            {
                oldNotificationSetting.Value = notificationSetting.Value;
                _notificationSettingsRepository.UpdateNotificationSetting(oldNotificationSetting);
            }
            else
            {
                _notificationSettingsRepository.CreateNotificationSetting(notificationSetting);
            }
        }
예제 #3
0
        public void UpdateNotificationSetting(NotificationSetting notificationSetting)
        {
            Require.NotNull(notificationSetting, nameof(notificationSetting));

            var oldNotificationSetting = _notificationSettingsRepository.ReadNotificationSettingByCriteria(
                setting => setting.UserId == notificationSetting.UserId &&
                setting.NotificationType == notificationSetting.NotificationType);

            if (oldNotificationSetting != null)
            {
                oldNotificationSetting.Value = notificationSetting.Value;
                _notificationSettingsRepository.UpdateNotificationSetting(oldNotificationSetting);
            }
            else
            {
                _notificationSettingsRepository.CreateNotificationSetting(notificationSetting);
            }
        }