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"); }
/// <summary> /// Deprecated Method for adding a new object to the ProductAttribute EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProductAttribute(ProductAttribute productAttribute) { base.AddObject("ProductAttribute", productAttribute); }
/// <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; }