public async Task <DocumentParametersDto> GetParametersAsync(GetParametersDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); input.Version = GetProjectVersionPrefixIfExist(project) + input.Version; try { if (string.IsNullOrWhiteSpace(project.ParametersDocumentName)) { return(await Task.FromResult <DocumentParametersDto>(null)); } var document = await GetDocumentWithDetailsDtoAsync( project, project.ParametersDocumentName, input.LanguageCode, input.Version ); if (!DocsJsonSerializerHelper.TryDeserialize <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()); } }
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 ); return(JsonConvert.DeserializeObject <DocumentParametersDto>(document.Content)); } catch (DocumentNotFoundException) { Logger.LogWarning($"Parameter file ({project.ParametersDocumentName}) not found."); return(new DocumentParametersDto()); } }
public Task <DocumentParametersDto> GetParametersAsync(GetParametersDocumentInput input) { return(DocumentAppService.GetParametersAsync(input)); }