public ActionResult ChangePassword(Parent p) { if (ModelState.IsValid) { ParentDal dal = new ParentDal(); p.PPassword = Request.Form["Password"].ToString(); dal.SaveChanges(); return(View("SendPassword", p)); } return(View(p)); }
//public ActionResult ParentEnter() //{ // ParentViewModel prn = new ParentViewModel(); // prn.parent = new Parent(); // prn.parents = new List<Parent>(); // return View(prn); //} public ActionResult Submit() { ParentViewModel par = new ParentViewModel(); Parent objParent = new Parent(); objParent.PFirstName = Request.Form["parent.PFirstName"].ToString(); objParent.PLastName = Request.Form["parent.PLastName"].ToString(); objParent.PIdNumber = Request.Form["parent.PIdNumber"].ToString(); objParent.PEmail = Request.Form["parent.PEmail"].ToString(); objParent.PPassword = Request.Form["parent.PPassword"].ToString(); objParent.PStudentIdNumber = Request.Form["parent.PStudentIdNumber"].ToString(); objParent.PAssistantEmployeeNumber = Request.Form["parent.PAssistantEmployeeNumber"].ToString(); ParentDal dal = new ParentDal(); //if (ModelState.IsValid) // return View("Student", stud); //else // return View("StudentEnter", stud); if (ModelState.IsValid) { //AssistantDal dal = new AssistantDal(); //dal.Assistants.Add(myAssistant);// in memory adding //dal.SaveChanges(); //return View("Assistant", myAssistant); dal.parents.Add(objParent);// in memory adding dal.SaveChanges(); par.parent = new Parent(); } //else // return View("Enter", myAssistant); else { par.parent = objParent; } par.parents = dal.parents.ToList <Parent>(); return(View("ParentEnter", par)); }