示例#1
0
        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());
        }
示例#2
0
        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));
        }