Esempio n. 1
0
 public void Create([FromBody] Teacher teacher)
 {
     if (ModelState.IsValid)
     {
         objteacher.AddTeacher(teacher);
     }
 }
Esempio n. 2
0
        public IActionResult AddTeacher([Bind("Name,Description")] Teacher teacher)
        {
            if (ModelState.IsValid)
            {
                teacher = teacherService.AddTeacher(teacher.Name, teacher.Description);
                return(RedirectToAction(nameof(Index)));
            }

            return(View(teacher));
        }
Esempio n. 3
0
        public void AddTeacher(TeacherInf teacherInf)
        {
            int result = teacher.AddTeacher(teacherInf);

            switch (result)
            {
            case 1: JScript.AlertAndRedirect("添加成功!", "AddTeacher.aspx");
                break;

            case 0: JScript.Alert("添加失败!请重试!");
                JScript.GoHistory(-1);
                break;

            case -2: JScript.Alert("教师编号已存在,请换其他编号");
                JScript.GoHistory(-1);
                break;
            }
        }