Created
February 10, 2016 22:40
-
-
Save daniiiol/591a977a1cdf6b2698cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IModelProcessor<in TTemplate, TModel> | |
{ | |
TModel GetElement(TModel model, TTemplate item); | |
} | |
public class TagProcessor : IModelProcessor<IBaseSitecoreItem, TaggingModel> | |
{ | |
public TaggingModel GetElement(TaggingModel model, IBaseSitecoreItem item) | |
{ | |
var castedItem = item as IAssetContainerTemplate; | |
if (castedItem == null) return model; | |
return new SpecificTaggingModel | |
{ | |
Id = model.Id, | |
Item = model.Item, | |
Name = castedItem.DisplayName.ToString(), | |
Synonyms = castedItem.AssetContainerDescriptionField.Value.Split(','), | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment