Esempio n. 1
0
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            Type type = GetTypeByName(controllerContext);

            return(_messageTemplateProvider.GetAllMessageTemplates(_site)
                   .FirstOrDefault(template => template.SiteId == _site.Id && template.GetType() == type));
        }
Esempio n. 2
0
        public List <MessageTemplateInfo> GetAllMessageTemplateTypesWithDetails()
        {
            List <MessageTemplate> templates = _messageTemplateProvider.GetAllMessageTemplates(_site);
            IList <string>         legacyMessageTemplateTypes =
                _session.QueryOver <LegacyMessageTemplate>()
                .Where(template => !template.Imported)
                .Select(template => template.MessageTemplateType)
                .Cacheable()
                .List <string>();

            return(templates.Select(template =>
            {
                Type type = template.GetType();
                return new MessageTemplateInfo
                {
                    Type = type,
                    IsOverride = template.SiteId.HasValue,
                    CanPreview = CanPreview(template),
                    IsEnabled = !template.IsDisabled,
                    LegacyTemplateExists =
                        legacyMessageTemplateTypes.Contains(type.FullName, StringComparer.InvariantCultureIgnoreCase)
                };
            }).ToList());
        }
Esempio n. 3
0
 public MessageTemplate GetTemplate(string type)
 {
     return(_messageTemplateProvider.GetAllMessageTemplates(_site).FirstOrDefault(x => x.GetType().FullName == type));
 }