/// <summary> /// Deprecated Method for adding a new object to the Depts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDepts(Dept dept) { base.AddObject("Depts", dept); }
public ActionResult DeptNew(Dept dept) { if (ModelState.IsValid) { db.Depts.AddObject(dept); db.SaveChanges(); return RedirectToAction("DeptList"); } return View(dept); }
/// <summary> /// Create a new Dept object. /// </summary> /// <param name="deptId">Initial value of the DeptId property.</param> /// <param name="deptName">Initial value of the DeptName property.</param> public static Dept CreateDept(global::System.Int32 deptId, global::System.String deptName) { Dept dept = new Dept(); dept.DeptId = deptId; dept.DeptName = deptName; return dept; }
public ActionResult DeptEdit(Dept dept) { if (ModelState.IsValid) { db.Depts.Attach(dept); db.ObjectStateManager.ChangeObjectState(dept, EntityState.Modified); db.SaveChanges(); return RedirectToAction("DeptList"); } return View(dept); }