Exemplo n.º 1
0
        public async Task SaveNotificationSetting(List <UserNotificatioSettingModel> userNotificatioSettings, int userId, Enums.UserRole userRole, string CR = "")
        {
            if (userRole == Enums.UserRole.NewMonafasat_Supplier)
            {
                var userProfile = await _iNotificationQuerie.GetSupplierUser(CR);

                foreach (var setting in userNotificatioSettings)
                {
                    userProfile.UpdateNotificationSetting(Util.Decrypt(setting.Id), setting.EmailEnabled, setting.SMSEnabled);
                }
                await _notifayCommands.UpdateSupplierAsync(userProfile);
            }
            else
            {
                var userProfile = await _iNotificationQuerie.GetUser(userId);

                foreach (var setting in userNotificatioSettings)
                {
                    userProfile.UpdateNotificationSetting(Util.Decrypt(setting.Id), setting.EmailEnabled, setting.SMSEnabled);
                }
                await _notifayCommands.UpdateAsync(userProfile);
            }
        }