Пример #1
0
        private FilterValues CalculateMovieFilterValues(string field, string[] libraryIds)
        {
            var values = new FilterValues
            {
                Id        = Guid.NewGuid().ToString(),
                Field     = field,
                Libraries = libraryIds
            };

            switch (field.ToLowerInvariant())
            {
            case "subtitle":
                values.Values = _movieRepository.CalculateSubtitleFilterValues(libraryIds).ToArray();
                break;

            case "genre":
                values.Values = _movieRepository.CalculateGenreFilterValues(libraryIds).ToArray();
                break;

            case "container":
                values.Values = _movieRepository.CalculateContainerFilterValues(libraryIds).ToArray();
                break;

            case "collection":
                values.Values = _movieRepository.CalculateCollectionFilterValues().ToArray();
                break;

            case "codec":
                values.Values = _movieRepository.CalculateCodecFilterValues(libraryIds).ToArray();
                break;

            case "videorange":
                values.Values = _movieRepository.CalculateVideoRangeFilterValues(libraryIds).ToArray();
                break;

            default: return(null);
            }

            _filterRepository.Insert(values);
            return(values);
        }