public ActionResult EditContentItem(BuildingItem model) { var ci = _context.BuildingItem.Include("Building").First(c => c.Id == model.Id); ci.SortOrder = model.SortOrder; ci.Text = HttpUtility.HtmlDecode(model.Text); _context.SaveChanges(); var parent = _context.Building.Include("Parent").First(t => t.Id == ci.BuildingId); string catId = ""; string subCatId = ""; if (parent.Parent != null) { catId = parent.Parent.Name; subCatId = parent.Name; } else { catId = parent.Name; } return RedirectToAction("Buildings", "Home", new { area = "", categoryId = catId, subCategoryId = subCatId }); }
/// <summary> /// Deprecated Method for adding a new object to the BuildingItem EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBuildingItem(BuildingItem buildingItem) { base.AddObject("BuildingItem", buildingItem); }
public ActionResult AddContentItem(int contentId, BuildingItem model) { var content = _context.Building.Include("Parent").First(c => c.Id == contentId); string catId = ""; string subCatId = ""; if (content.Parent != null) { catId = content.Parent.Name; subCatId = content.Name; } else { catId = content.Name; } var ci = new BuildingItem { SortOrder = model.SortOrder, Text = HttpUtility.HtmlDecode(model.Text) }; content.BuildingItems.Add(ci); _context.SaveChanges(); return RedirectToAction("Buildings", "Home", new { area = "", categoryId = catId, subCategoryId = subCatId }); }
/// <summary> /// Create a new BuildingItem object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="text">Initial value of the Text property.</param> /// <param name="sortOrder">Initial value of the SortOrder property.</param> /// <param name="buildingId">Initial value of the BuildingId property.</param> public static BuildingItem CreateBuildingItem(global::System.Int32 id, global::System.String text, global::System.Int32 sortOrder, global::System.Int32 buildingId) { BuildingItem buildingItem = new BuildingItem(); buildingItem.Id = id; buildingItem.Text = text; buildingItem.SortOrder = sortOrder; buildingItem.BuildingId = buildingId; return buildingItem; }