public ActionResult Create(Teacher teacher)
        {
            if (ModelState.IsValid)
            {
                db.Teachers.Add(teacher);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.DesignationId = new SelectList(db.Designations, "Id", "Name", teacher.DesignationId);
            ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Code", teacher.DepartmentId);
            return View(teacher);
        }
 public ActionResult Edit(Teacher teacher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teacher).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.DesignationId = new SelectList(db.Designations, "Id", "Name", teacher.DesignationId);
     ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Code", teacher.DepartmentId);
     return View(teacher);
 }