/// <summary> /// Create a new Division object. /// </summary> /// <param name="divisionId">Initial value of the DivisionId property.</param> /// <param name="deptId">Initial value of the DeptId property.</param> /// <param name="divisionName">Initial value of the DivisionName property.</param> /// <param name="isSupporting">Initial value of the IsSupporting property.</param> public static Division CreateDivision(global::System.Int32 divisionId, global::System.Int32 deptId, global::System.String divisionName, global::System.Boolean isSupporting) { Division division = new Division(); division.DivisionId = divisionId; division.DeptId = deptId; division.DivisionName = divisionName; division.IsSupporting = isSupporting; return division; }
public ActionResult DivNew(Division div, int deptId) { if (ModelState.IsValid) { div.DeptId = deptId; db.Divisions.AddObject(div); db.SaveChanges(); return RedirectToAction("DivList", new { deptid = deptId }); } return View(new { deptid = deptId }); }
/// <summary> /// Deprecated Method for adding a new object to the Divisions EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDivisions(Division division) { base.AddObject("Divisions", division); }
public ActionResult DivEdit(Division div) { if (ModelState.IsValid) { db.Divisions.Attach(div); db.ObjectStateManager.ChangeObjectState(div, EntityState.Modified); db.SaveChanges(); ViewBag.DeptId = div.DeptId; Dept dept = db.Depts.Single(p => p.DeptId == div.DeptId); ViewBag.DeptName = dept.DeptName; return RedirectToAction("DivList", new { deptid = div.DeptId }); } return View(div); }