Beispiel #1
0
        /// <summary>
        /// Установить текущий язык пользователя
        /// </summary>
        public async Task <Result> SetCurrentLanguage(Guid userId, LanguageCode code)
        {
            if (userId == default)
            {
                _logger.Warning("LanguageService. UserId not set");
                return(Result.Failure(ErrorCodes.ValidationError));
            }

            Result <string> result = await _userManagementServiceClient.SetCurrentLanguage(new SetUserLanguageClientDto { UserId = userId, Code = (LanguageCodeClient)code });

            if (result.IsFailure)
            {
                _logger.Warning($"LanguageService. Language settings has not been changed by userId: {userId}");
                return(Result.Failure(ErrorCodes.LanguagesNotFound));
            }

            _logger.Information($"LanguageService. Language settings changed for user with userId: {userId}");
            return(Result.Success());
        }