Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public interface IModelProcessor<in TTemplate, TModel>
  2. {
  3. TModel GetElement(TModel model, TTemplate item);
  4. }
  5.  
  6.  
  7. public class TagProcessor : IModelProcessor<IBaseSitecoreItem, TaggingModel>
  8. {
  9. public TaggingModel GetElement(TaggingModel model, IBaseSitecoreItem item)
  10. {
  11.  
  12. var castedItem = item as IAssetContainerTemplate;
  13. if (castedItem == null) return model;
  14.  
  15. return new SpecificTaggingModel
  16. {
  17. Id = model.Id,
  18. Item = model.Item,
  19. Name = castedItem.DisplayName.ToString(),
  20. Synonyms = castedItem.AssetContainerDescriptionField.Value.Split(','),
  21. };
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement