public ActionResult ChangePassword(Teacher t) { if (ModelState.IsValid) { TeacherDal dal = new TeacherDal(); t.Password = Request.Form["Password"].ToString(); dal.SaveChanges(); return(View("SendPassword", t)); } return(View(t)); }
//public ActionResult Submit([ModelBinder(typeof(TeacherBinder))] Teacher myTeacher) public ActionResult Submit(Teacher myTeacher) { //Teacher myTeacher = new Teacher(); //myTeacher.FirstName = Request.Form["FirstName"]; //myTeacher.LastName = Request.Form["LastName"]; //myTeacher.TeacherId = Request.Form["TeacherId"]; if (ModelState.IsValid) { TeacherDal dal = new TeacherDal(); dal.Teachers.Add(myTeacher);// in memory adding dal.SaveChanges(); return(View("Teacher", myTeacher)); } else { return(View("Enter", myTeacher)); } }