protected void btnInsert_Click(object sender, EventArgs e) { try { progDec = new ProgDec(); progDec.ProgramId = programs[ddlPrograms.SelectedIndex].Id; progDec.StudentId = students[ddlStudents.SelectedIndex].Id; int results = ProgDecManager.Insert(progDec); Response.Write("Inserted " + results + " rows."); progDecs.Add(progDec); Rebind(); if (results > 0) { ddlChangeDate.SelectedValue = progDec.Id.ToString(); } ddlChangeDate_SelectedIndexChanged(sender, e); } catch (Exception ex) { Response.Write(ex.Message); } }
public void InsertTest() { ProgDec progDec = new ProgDec { ProgramId = 12, StudentId = 4 }; Assert.AreNotEqual(0, ProgDecManager.Insert(progDec)); }
public ActionResult Create(ProgDecProgramsStudents pps) { try { ProgDecManager.Insert(pps.ProgDec); pps.AdvisorIds.ToList().ForEach(a => ProgDecAdvisorManager.Add(pps.ProgDec.Id, a)); return(RedirectToAction("Index")); } catch { return(View()); } }
// POST: api/ProgDec public void Post([FromBody] ProgramDec.BL.Models.ProgDec progDec) { ProgDecManager.Insert(progDec); }