Exemplo n.º 1
0
 public ActionResult Edit(Element model)
 {
     using (var context = new ModelContainer())
     {
         var element = context.Element.First(e => e.Id == model.Id);
         TryUpdateModel(element, new[] { "Title", "SortOrder" });
         context.SaveChanges();
     }
     return RedirectToAction("Index", "Home", new { Area = "", id="" });
 }
Exemplo n.º 2
0
 public ActionResult Create(FormCollection form)
 {
     using (var context = new ModelContainer())
     {
         var element = new Element();
         TryUpdateModel(element, new[] { "Title", "SortOrder" });
         context.AddToElement(element);
         context.SaveChanges();
     }
     return RedirectToAction("Index", "Home", new { Area = "", id = "" });
 }
Exemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Element EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToElement(Element element)
 {
     base.AddObject("Element", element);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new Element object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 public static Element CreateElement(global::System.Int32 id, global::System.String title)
 {
     Element element = new Element();
     element.Id = id;
     element.Title = title;
     return element;
 }