public ActionResult EditContentItem(ContentItem model) { var ci = _context.ContentItem.Include("Content").First(c => c.Id == model.Id); ci.SortOrder = model.SortOrder; ci.Text = HttpUtility.HtmlDecode(model.Text); _context.SaveChanges(); return RedirectToAction("SiteContent", "Home", new { area = "", id = ci.Content.Name }); }
public ActionResult AddContentItem(int contentId, ContentItem model) { var content = _context.Content.First(c => c.Id == contentId); var ci = new ContentItem { SortOrder = model.SortOrder, Text = HttpUtility.HtmlDecode(model.Text) }; content.ContentItems.Add(ci); _context.SaveChanges(); return RedirectToAction("SiteContent", "Home", new { area="", id = content.Name }); }
/// <summary> /// Deprecated Method for adding a new object to the ContentItem EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContentItem(ContentItem contentItem) { base.AddObject("ContentItem", contentItem); }
/// <summary> /// Create a new ContentItem object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="sortOrder">Initial value of the SortOrder property.</param> /// <param name="contentId">Initial value of the ContentId property.</param> public static ContentItem CreateContentItem(global::System.Int32 id, global::System.Int32 sortOrder, global::System.Int32 contentId) { ContentItem contentItem = new ContentItem(); contentItem.Id = id; contentItem.SortOrder = sortOrder; contentItem.ContentId = contentId; return contentItem; }
public ActionResult EditContentItem(ContentItem model) { var ci = _context.TechnologyItem.Include("Technology").First(c => c.Id == model.Id); ci.SortOrder = model.SortOrder; ci.Text = HttpUtility.HtmlDecode(model.Text); _context.SaveChanges(); var parent = _context.Technology.Include("Parent").First(t => t.Id == ci.TechnologyId); string catId = ""; string subCatId = ""; if (parent.Parent != null) { catId = parent.Parent.Name; subCatId = parent.Name; } else { catId = parent.Name; } return RedirectToAction("Technologies", "Home", new { area = "", categoryId = catId, subCategoryId = subCatId }); }