/// <summary> /// Deprecated Method for adding a new object to the ProductSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProductSet(ProductSet productSet) { base.AddObject("ProductSet", productSet); }
public ActionResult AddProductSet(string customerId, FormCollection form) { using (var context = new LibraryContainer()) { var customer = context.Customer.Include("ProductSets").First(c => c.Name == customerId); var productSet = new ProductSet(); TryUpdateModel(productSet, new[] { "Title" }); customer.ProductSets.Add(productSet); context.SaveChanges(); return RedirectToAction("Index", "Customer"); } }
/// <summary> /// Create a new ProductSet object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="customerId">Initial value of the CustomerId property.</param> public static ProductSet CreateProductSet(global::System.Int32 id, global::System.String title, global::System.Int32 customerId) { ProductSet productSet = new ProductSet(); productSet.Id = id; productSet.Title = title; productSet.CustomerId = customerId; return productSet; }