Exemplo n.º 1
0
 public ActionResult UpdateTeacherDetails(Teachers teacher)
 {
     try
     {
         DBHelper.Instance.UpdateTeacher(teacher);
         return Json(new { success = "Профиль преподавателя обновлен" });
     }
     catch (Exception ex)
     {
         return Json(new { errors = ex.Message });
     }
 }
Exemplo n.º 2
0
 // Create new teacher
 public int CreateTeacher(Teachers teacher)
 {
     db.Teachers.Add(teacher);
     db.SaveChanges();
     return db.Teachers.Where(t => t.Login == teacher.Login).Select(t => t.TeacherId).FirstOrDefault();
 }
Exemplo n.º 3
0
 public void UpdateTeacher(Teachers model)
 {
     try
     {
         var teacher = db.Teachers.Where(t => t.TeacherId == model.TeacherId).FirstOrDefault();
         teacher.FirstName = model.FirstName;
         teacher.LastName = model.LastName;
         teacher.Subject = model.Subject;
         db.Entry(teacher).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new DBException("UpdateTeacher(): ", ex.ToString());
     }
 }