Esempio n. 1
0
        public NotificationSetting(int userId, NotificationType notificationType, NotificationSettingValue value)
        {
            Require.NotNull(notificationType, nameof(notificationType));
            Require.NotNull(value, nameof(value));
            Require.Positive(userId, nameof(userId));

            UserId           = userId;
            NotificationType = notificationType;
            Value            = value;
        }
        public NotificationSetting(int userId, NotificationType notificationType, NotificationSettingValue value)
        {
            Require.NotNull(notificationType, nameof(notificationType));
            Require.NotNull(value, nameof(value));
            Require.Positive(userId, nameof(userId));

            UserId = userId;
            NotificationType = notificationType;
            Value = value;
        }
        private NotificationSettings FillNotificationSettings(NotificationSettingKey notificationSettingKey, NotificationSettingValue notificationSettingValue, NotificationSettings notificationSettings)
        {
            switch (notificationSettingKey)
            {
            case NotificationSettingKey.GroupNotifications:
            {
                notificationSettings.IsChannelNotificationsDisabled = notificationSettingValue;
                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException();
            }
            }

            return(notificationSettings);
        }
Esempio n. 4
0
        public async Task <IActionResult> UpdateUserNotificationSettingsAsync(NotificationSettingKey key, [FromBody] NotificationSettingValue value)
        {
            var userId = GetCurrentSaasUserId();
            var res    = await _notificationSettingsService.UpdateUserNotificationSettingsAsync(new NotificationSettingRequest(userId)
            {
                Key   = key,
                Value = value
            });

            return(Ok(res));
        }