예제 #1
0
        public ActionResult CreateStudentUser(string currentUsername, string newUsername, string firstname, string lastname, string cohort, string emailAddress)
        {
            if (!ModelState.IsValid)
            {
                return(View("CreateStudentUser"));
            }

            //add user to correct db's

            bool userPassword = userPasswordDal.AddUser(newUsername, "password", "Student");

            if (!userPassword)
            {
                return(View("Fail"));
            }
            bool student = studentDal.AddStudentUser(newUsername, firstname, lastname, cohort, emailAddress);

            if (!student)
            {
                return(View("Fail"));
            }

            SendEmail(emailAddress, firstname, newUsername, "Student");
            return(RedirectToAction("Success", new { username = base.CurrentUser }));
        }