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)); }
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; }
/// <summary> /// Deprecated Method for adding a new object to the ContentTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContentTypes(ContentType contentType) { base.AddObject("ContentTypes", contentType); }
/// <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; }