public JsonResult AddTeacher(Teacher teacher) { if (teacher == null) { return(Json(new { Message = "Error", HasError = true })); } var dao = new TeacherDAO(); var message = dao.AddTeacher(teacher); return(Json(new { Message = message })); }
private void simpleButtonOK_Click(object sender, EventArgs e) { TeacherDAO d = new TeacherDAO(); TeacherBean b = new TeacherBean(); foreach (DataRow r in tabTeacher.Rows) { b.StaffNumber = r["StaffNumber"].ToString(); b.Id = Convert.ToInt32(r["Id"].ToString()); string status = r["Status"].ToString(); if (status == "Adding") { d.AddTeacher(b); } else if (status == "Deleting") { d.DeleteTeacher(b); } } }