public ActionResult Edit(ProductAttribute model, FormCollection form)
 {
     using (var context = new SiteContainer())
     {
         var productAttribute = context.ProductAttribute.First(pa => pa.Id == model.Id);
         TryUpdateModel(productAttribute, new[] { "Title" });
         context.SaveChanges();
         return RedirectToAction("Index");
     }
 }
 public ActionResult Create(ProductAttribute model)
 {
     using (var context = new SiteContainer())
     {
         var pa = new ProductAttribute();
         TryUpdateModel(pa, new[] { "Title" });
         context.AddToProductAttribute(pa);
         context.SaveChanges();
     }
     return RedirectToAction("Index");
 }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductAttribute EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductAttribute(ProductAttribute productAttribute)
 {
     base.AddObject("ProductAttribute", productAttribute);
 }
Beispiel #4
0
 /// <summary>
 /// Create a new ProductAttribute object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 public static ProductAttribute CreateProductAttribute(global::System.Int32 id, global::System.String title)
 {
     ProductAttribute productAttribute = new ProductAttribute();
     productAttribute.Id = id;
     productAttribute.Title = title;
     return productAttribute;
 }