Ejemplo n.º 1
0
        public object GetExamples([FromQuery] NamingConfigResource config)
        {
            if (config.Id == 0)
            {
                config = GetNamingConfig();
            }

            var nameSpec       = config.ToModel();
            var sampleResource = new NamingExampleResource();

            var singleTrackSampleResult    = _filenameSampleService.GetStandardTrackSample(nameSpec);
            var multiDiscTrackSampleResult = _filenameSampleService.GetMultiDiscTrackSample(nameSpec);

            sampleResource.SingleBookExample = _filenameValidationService.ValidateTrackFilename(singleTrackSampleResult) != null
                    ? null
                    : singleTrackSampleResult.FileName;

            sampleResource.MultiPartBookExample = _filenameValidationService.ValidateTrackFilename(multiDiscTrackSampleResult) != null
                ? null
                : multiDiscTrackSampleResult.FileName;

            sampleResource.AuthorFolderExample = nameSpec.AuthorFolderFormat.IsNullOrWhiteSpace()
                ? null
                : _filenameSampleService.GetAuthorFolderSample(nameSpec);

            return(sampleResource);
        }