private void SetDefaultApplicationNotifySetting(Guid userId, NotificationType notifyType) { Core.Models.Messaging.EF.UserMessagingPreference pref = new Core.Models.Messaging.EF.UserMessagingPreference() { UserId = userId, Channel = Channel.Web, NotificationType = notifyType }; _messagingPrefRepo.Create(pref); }
public void CreateMessagingPreferencesByCustomer(Guid userId, ProfileMessagingPreferenceModel messagingPrefModel) { //this also works for user default since customer = null for user default foreach (var currentPreference in messagingPrefModel.Preferences) { foreach (var channel in currentPreference.SelectedChannels) { var newPreference = new UserMessagingPreference() { Channel = channel.Channel, CustomerNumber = messagingPrefModel.CustomerNumber, NotificationType = currentPreference.NotificationType, UserId = userId, BranchId = messagingPrefModel.BranchId == null ? null : messagingPrefModel.BranchId.ToLower() }; _userMessagingPreferenceRepository.Create(newPreference); } } _uow.SaveChanges(); }