Exemplo n.º 1
0
        private async Task CreateDefaultTranslation(ProductCategoryChangedEvent e)
        {
            var defaultLocaleResult = await _localesService.GetDefaultLocale();

            if (defaultLocaleResult.IsFailed)
            {
                // cannot create localized values if default locale does not exist
                throw new DefaultLocaleDoesNotExistException("Default locale must exist before trying to create currency translations");
            }

            var value = new LocalizedValue()
            {
                Locale = defaultLocaleResult.Value.Id,
                Key    = e.NewValue.LocalizationToken,
                Value  = e.OriginalCategoryName ?? e.NewValue.Id,
            };

            await _localizedValuesService.AddAsync(value, e.Username, e.CorrelationId);
        }
Exemplo n.º 2
0
        private async Task CreateDefaultTranslation(CurrencyChangedEvent e)
        {
            var defaultLocaleResult = await _localesService.GetDefaultLocale();

            if (defaultLocaleResult.IsFailed)
            {
                // cannot create localized values if default locale does not exist
                throw new DefaultLocaleDoesNotExistException("Default locale must exist before trying to create currency translations");
            }

            var value = new LocalizedValue()
            {
                Locale = defaultLocaleResult.Value.Id,
                Key    = GetKey(e.NewValue.Id),
                Value  = e.NewValue.InterestRateMdsCode,
            };

            await _localizedValuesService.AddAsync(value, e.Username, e.CorrelationId);
        }