Ejemplo n.º 1
0
        public async Task <DocumentParametersDto> GetParametersAsync(GetParametersDocumentInput input)
        {
            var project = await _projectRepository.GetAsync(input.ProjectId);

            try
            {
                if (string.IsNullOrWhiteSpace(project.ParametersDocumentName))
                {
                    return(await Task.FromResult <DocumentParametersDto>(null));
                }

                var document = await GetDocumentWithDetailsDtoAsync(
                    project,
                    project.ParametersDocumentName,
                    input.LanguageCode,
                    input.Version
                    );

                if (!JsonConvertExtensions.TryDeserializeObject <DocumentParametersDto>(document.Content, out var documentParameters))
                {
                    throw new UserFriendlyException($"Cannot validate document parameters file '{project.ParametersDocumentName}' for the project {project.Name}.");
                }

                return(documentParameters);
            }
            catch (DocumentNotFoundException)
            {
                Logger.LogWarning($"Parameter file ({project.ParametersDocumentName}) not found!");
                return(new DocumentParametersDto());
            }
        }
Ejemplo n.º 2
0
 public Task <DocumentParametersDto> GetParametersAsync(GetParametersDocumentInput input)
 {
     return(DocumentAppService.GetParametersAsync(input));
 }