Example #1
0
 /// <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;
 }
Example #2
0
 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 });
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Divisions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDivisions(Division division)
 {
     base.AddObject("Divisions", division);
 }
Example #4
0
        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);
        }