コード例 #1
0
        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 }));
        }
コード例 #2
0
        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);
                }
            }
        }