public ActionResult Edit(ProductAttribute model, FormCollection form)
 {
     using (var context = new StructureContainer())
     {
         var productAttribute = context.ProductAttribute.First(pa => pa.Id == model.Id);
         TryUpdateModel(productAttribute, new[] { "Title", "TitleEng" });
         context.SaveChanges();
         return RedirectToAction("Index");
     }
 }
 public ActionResult Create(ProductAttribute model)
 {
     using (var context = new StructureContainer())
     {
         var pa = new ProductAttribute();
         TryUpdateModel(pa, new[] { "Title", "TitleEng" });
         context.AddToProductAttribute(pa);
         context.SaveChanges();
     }
     return RedirectToAction("Index");
 }
示例#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);
 }
示例#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>
 /// <param name="titleEng">Initial value of the TitleEng property.</param>
 public static ProductAttribute CreateProductAttribute(global::System.Int32 id, global::System.String title, global::System.String titleEng)
 {
     ProductAttribute productAttribute = new ProductAttribute();
     productAttribute.Id = id;
     productAttribute.Title = title;
     productAttribute.TitleEng = titleEng;
     return productAttribute;
 }