protected override ModelMetadata CreateMetadata( IEnumerable <Attribute> attributes, Type containerType, Func <object> modelAccessor, Type modelType, string propertyName) { var meta = base.CreateMetadata (attributes, containerType, modelAccessor, modelType, propertyName); if (string.IsNullOrEmpty(propertyName)) { return(meta); } if (meta.DisplayName == null) { var qualifiedKey = string.Format("{0}.{1}", modelType.Name, propertyName); meta.DisplayName = ContextualString.Get(qualifiedKey); } if (string.IsNullOrEmpty(meta.DisplayName)) { meta.DisplayName = string.Format("{0}", propertyName.ToSentenceCase()); } return(meta); }
public static MvcHtmlString LookupImage <TModel, TValue>(this HtmlHelper <TModel> html, string id, Expression <Func <TModel, TValue> > expression, IDictionary <string, object> htmlAttributes) { var tag = new TagBuilder("img"); tag.MergeAttributes(htmlAttributes); tag.Attributes.Add("src", ContextualString.Get(id)); return(MvcHtmlString.Create(tag.ToString(TagRenderMode.Normal))); }
public static MvcHtmlString Lookup <TModel>(this HtmlHelper <TModel> html, string id) { return(MvcHtmlString.Create(ContextualString.Get(id))); }