public static string Cms(this HtmlHelper htmlHelper, ContentType contentType)
        {
            Contract.Requires(htmlHelper != null);
            Contract.Requires(htmlHelper.ViewData != null);
            Contract.Requires<ArgumentNullException>(contentType !=null);

            var bundle = (ContentBundle)htmlHelper.ViewData[ViewDataKey];
            Contract.Assume(bundle != null);
            return string.Format(htmlElement, contentType.Id, bundle.GetContent(contentType.Id));
        }
示例#2
0
 public string GetContent(ContentType contentType)
 {
     var content = this._persistance.CreateQueryContext<Content>().Where(
         c => c.ContentTypeId == contentType.Id && c.NeighborhoodId == this._neighborhoodId).Select(c=>c.Text).FirstOrDefault();
     if (content == null)
     {
         content = contentType.Name;
     }
     return content;
 }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ContentTypes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToContentTypes(ContentType contentType)
 {
     base.AddObject("ContentTypes", contentType);
 }
示例#4
0
 /// <summary>
 /// Create a new ContentType object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static ContentType CreateContentType(global::System.Guid id)
 {
     ContentType contentType = new ContentType();
     contentType.Id = id;
     return contentType;
 }