public ActionResult Create(int id, int parentId, FormCollection form) { using (var context = new ContentStorage()) { var content = context.Content.Where(c => c.Id == id).First(); var accordion = new Accordion(); TryUpdateModel(accordion, new[] { "Title", "SortOrder" }); accordion.Text = HttpUtility.HtmlDecode(form["Text"]); accordion.Content = content; context.AddToAccordion(accordion); context.SaveChanges(); if(content.PlaceKind>0) return RedirectToAction("Index", "Place", new { id = content.Name, area = "" }); return RedirectToAction("Index", "Home", new { id = content.Name, area = "" }); } }
/// <summary> /// Create a new Accordion object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="sortOrder">Initial value of the SortOrder property.</param> public static Accordion CreateAccordion(global::System.Int64 id, global::System.Int32 sortOrder) { Accordion accordion = new Accordion(); accordion.Id = id; accordion.SortOrder = sortOrder; return accordion; }
/// <summary> /// Deprecated Method for adding a new object to the Accordion EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAccordion(Accordion accordion) { base.AddObject("Accordion", accordion); }