public ActionResult Create(DivisionModel m) { var d = new Division { Name = "New Division" }; d.ProgId = m.TagProgramId; d.ProgDivs.Add(new ProgDiv { ProgId = m.TagProgramId.Value }); DbUtil.Db.Divisions.InsertOnSubmit(d); DbUtil.Db.SubmitChanges(); DbUtil.Db.Refresh(RefreshMode.OverwriteCurrentValues, d); var di = m.DivisionItem(d.Id).Single(); return View("Row", di); }
public ActionResult MainProg(int id, DivisionModel m) { var division = DbUtil.Db.Divisions.Single(d => d.Id == id); division.ProgId = m.TagProgramId; DbUtil.Db.SubmitChanges(); DbUtil.Db.Refresh(RefreshMode.OverwriteCurrentValues, division); var di = m.DivisionItem(id).Single(); return View("Row", di); }