public ActionResult PersonalInfo(int id) { var queryStudent = _unitOfWork.Student.GetByID(id); if (queryStudent != null) { Portal portalStudent = new Portal(); var auto = AutoMapper.Mapper.Map(queryStudent, portalStudent); auto.StudentPassword = Crypto.Hash(queryStudent.StudentPassword); return(View(auto)); } return(HttpNotFound()); }
public ActionResult PersonalInfo(Portal portalStudent) { if (ModelState.IsValid) { Student student = new Student(); var learner = AutoMapper.Mapper.Map(portalStudent, student); learner.StudentPassword = Crypto.Hash(portalStudent.StudentPassword); _unitOfWork.Student.UpdatEntity(learner); _unitOfWork.Complete(); var autoPortal = AutoMapper.Mapper.Map(learner, portalStudent); return(RedirectToAction("UserHome", new { id = autoPortal.StudentID })); } return(View(portalStudent)); }