コード例 #1
0
        public ActionResult ForgotPassword(string username, string role)
        {
            UserPassword user = userPasswordDal.GetUser(username);

            if (user == null)
            {
                ModelState.AddModelError("invalid username", "A registered username is required");
            }

            if (user.RoleTitle == "Employer")
            {
                string contactEmail = employerDal.GetEmployer(username).ContactInfo;
                string newPassword  = userPasswordDal.ResetPassword(username);
                SendEmail(contactEmail, username, newPassword);
            }
            else if (user.RoleTitle == "Student")
            {
                string contactEmail = studentDal.GetStudent(username).ContactInfo;
                string newPassword  = userPasswordDal.ResetPassword(username);
                SendEmail(contactEmail, username, newPassword);
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #2
0
        public ActionResult ViewStudent(string username)
        {
            Student model = studentDAL.GetStudent(username);

            return(View("ViewStudent", model));
        }
コード例 #3
0
        // GET: Student
        public ActionResult Index(string username)
        {
            Student currentUser = studentDAL.GetStudent(username);

            return(View("Index", currentUser));
        }