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); }
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)); }