<commit_before>﻿using System.Linq;
using Orchard.ContentManagement.Metadata.Models;
using Orchard.ContentManagement.MetaData;

namespace Orchard.ContentTypes.ViewModels
{
    public class SelectContentTypesViewModel
    {
        public string HtmlName { get; set; }
        public ContentTypeSelection[] ContentTypeSelections { get; set; }
    }

    public class ContentTypeSelection
    {
        public bool IsSelected { get; set; }
        public ContentTypeDefinition ContentTypeDefinition { get; set; }

        public static ContentTypeSelection[] Build(IContentDefinitionManager contentDefinitionManager, string[] selectedContentTypes)
        {
            var contentTypes = contentDefinitionManager
                .ListTypeDefinitions()
                .Select(x =>
                    new ContentTypeSelection
                    {
                        IsSelected = selectedContentTypes.Contains(x.Name),
                        ContentTypeDefinition = x
                    })
                .ToArray();<commit_msg>Fix #403 : Order the content types by display name.<commit_after>﻿using System.Linq;
using Orchard.ContentManagement.Metadata.Models;
using Orchard.ContentManagement.MetaData;

namespace Orchard.ContentTypes.ViewModels
{
    public class SelectContentTypesViewModel
    {
        public string HtmlName { get; set; }
        public ContentTypeSelection[] ContentTypeSelections { get; set; }
    }

    public class ContentTypeSelection
    {
        public bool IsSelected { get; set; }
        public ContentTypeDefinition ContentTypeDefinition { get; set; }

        public static ContentTypeSelection[] Build(IContentDefinitionManager contentDefinitionManager, string[] selectedContentTypes)
        {
            var contentTypes = contentDefinitionManager
                .ListTypeDefinitions()
                .Select(x =>
                    new ContentTypeSelection
                    {
                        IsSelected = selectedContentTypes.Contains(x.Name),
                        ContentTypeDefinition = x
                    })
                .OrderBy(type => type.ContentTypeDefinition.DisplayName)
                .ToArray();
{'fraction_non_alphanumeric': 0.06608536025699863, 'fraction_numerical': 0.0013767783386874712, 'mean_word_length': 2.2106038291605303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4446202', 'n_tokens_mistral': 503, 'n_tokens_neox': 473, 'n_words': 115}