public ActionResult Create(subColor subcolor) { if (ModelState.IsValid) { db.subColors.AddObject(subcolor); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.colorId = new SelectList(db.colors, "id", "colorName", subcolor.colorId); return View(subcolor); }
/// <summary> /// Create a new subColor object. /// </summary> /// <param name="id">Initial value of the id property.</param> public static subColor CreatesubColor(global::System.Int32 id) { subColor subColor = new subColor(); subColor.id = id; return subColor; }
/// <summary> /// Deprecated Method for adding a new object to the subColors EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTosubColors(subColor subColor) { base.AddObject("subColors", subColor); }
public ActionResult Edit(subColor subcolor) { if (ModelState.IsValid) { db.subColors.Attach(subcolor); db.ObjectStateManager.ChangeObjectState(subcolor, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.colorId = new SelectList(db.colors, "id", "colorName", subcolor.colorId); return View(subcolor); }