mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00

--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4039306
24 lines
840 B
C#
24 lines
840 B
C#
using System.Collections.Generic;
|
|
using System.Web.Mvc;
|
|
using Orchard.Mvc.ModelBinders;
|
|
|
|
namespace Orchard.CmsPages.Models {
|
|
public class ContentItemListModelBinder : IModelBinderProvider {
|
|
private readonly ModelBinderDictionary _binders;
|
|
private readonly ModelMetadataProvider _provider;
|
|
|
|
public ContentItemListModelBinder(ModelBinderDictionary binders, ModelMetadataProvider provider) {
|
|
_binders = binders;
|
|
_provider = provider;
|
|
}
|
|
|
|
|
|
public IEnumerable<ModelBinderDescriptor> GetModelBinders() {
|
|
yield return new ModelBinderDescriptor {
|
|
Type = typeof(IList<ContentItem>),
|
|
ModelBinder = new KeyedListModelBinder<ContentItem>(_binders, _provider, item => item.ZoneName)
|
|
};
|
|
}
|
|
}
|
|
}
|