コード例 #1
0
        public ActionResult Create(ContentBody contentbody)
        {
            if (ModelState.IsValid)
            {
                db.ContentBodies.Attach(contentbody);
                db.ObjectStateManager.ChangeObjectState(contentbody, EntityState.Added);

                if (contentbody.Promote == "Y")
                {
                    UpdatePromotedArticle(contentbody.Id);
                }
                else
                {
                    contentbody.Promote = "N";
                    UpdatePromotedArticle(5); // article 5 is the dfault
                }

                db.SaveChanges();
            }
            ContentSection contentSection = db.ContentSections.Single(c => c.Id == contentbody.ContentSection_ID);
            ViewBag.SectionTitle = contentSection.Header;
            ViewData.Model = db.ContentBodies.Where(c => c.ContentSection_ID == contentbody.ContentSection_ID).ToList();
            return RedirectToAction("../ContentMaintenance/GetSectionItems/" + contentbody.ContentSection_ID);
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ContentBodies EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToContentBodies(ContentBody contentBody)
 {
     base.AddObject("ContentBodies", contentBody);
 }
コード例 #3
0
 /// <summary>
 /// Create a new ContentBody object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="bodyText">Initial value of the BodyText property.</param>
 /// <param name="contentSection_ID">Initial value of the ContentSection_ID property.</param>
 public static ContentBody CreateContentBody(global::System.Int32 id, global::System.String title, global::System.String bodyText, global::System.Int32 contentSection_ID)
 {
     ContentBody contentBody = new ContentBody();
     contentBody.Id = id;
     contentBody.Title = title;
     contentBody.BodyText = bodyText;
     contentBody.ContentSection_ID = contentSection_ID;
     return contentBody;
 }
コード例 #4
0
 /// <summary>
 /// Create a new ContentBody object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="bodyText">Initial value of the BodyText property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 /// <param name="subHeader">Initial value of the SubHeader property.</param>
 /// <param name="promote">Initial value of the Promote property.</param>
 /// <param name="creationDate">Initial value of the CreationDate property.</param>
 /// <param name="owner">Initial value of the Owner property.</param>
 /// <param name="contentSection_ID">Initial value of the ContentSection_ID property.</param>
 public static ContentBody CreateContentBody(global::System.Int32 id, global::System.String title, global::System.String bodyText, global::System.String type, global::System.String subHeader, global::System.String promote, global::System.String creationDate, global::System.String owner, global::System.Int32 contentSection_ID)
 {
     ContentBody contentBody = new ContentBody();
     contentBody.Id = id;
     contentBody.Title = title;
     contentBody.BodyText = bodyText;
     contentBody.Type = type;
     contentBody.SubHeader = subHeader;
     contentBody.Promote = promote;
     contentBody.CreationDate = creationDate;
     contentBody.Owner = owner;
     contentBody.ContentSection_ID = contentSection_ID;
     return contentBody;
 }