Ejemplo n.º 1
0
 public ActionResult Welcome(StudentSignUpView studentSignUp)
 {
     if ((UserStatus)TempData["StudentStatus"] == UserStatus.NowAuthenticated)
     {
         using (var dbContext = new ceit_gwa_databaseEntities1())
         {
             StudentWelcomeInfo studentWelcomeInfo = new StudentWelcomeInfo();
             studentWelcomeInfo.CourseList = dbContext.CeitCourses.ToList().Select(p => new SelectListItem
             {
                 Value = Convert.ToString(p.CourseId),
                 Text  = p.Text
             });
             studentWelcomeInfo.YearLevelList = dbContext.CeitYearLevels.ToList().Select(p => new SelectListItem
             {
                 Value = Convert.ToString(p.YearLevelId),
                 Text  = p.YearLevel
             });
             studentWelcomeInfo.SecurityQuestionList = dbContext.CeitSecurityQuestions.ToList().Select(p => new SelectListItem
             {
                 Value = Convert.ToString(p.QuestionsId),
                 Text  = p.SecurityQuestions
             });
             studentWelcomeInfo.GenderList = new SelectList(Enum.GetValues(typeof(Gender)));
             return(View("Welcome", studentWelcomeInfo));
         }
     }
     return(View());
 }
Ejemplo n.º 2
0
        public void UpdateStudentInfo(StudentWelcomeInfo studentWelcomeInfo)
        {
            using (var db = new ceit_gwa_databaseEntities1())
            {
                string      studentid;
                CeitStudent studentData;
                CeitUser    userData;

                if (GetStudentId(HttpContext.Current.User.Identity.Name) != null)
                {
                    studentid   = GetStudentId(HttpContext.Current.User.Identity.Name);
                    studentData = db.CeitStudents.FirstOrDefault(p => p.StudentID == studentid);
                    userData    = db.CeitUsers.FirstOrDefault(p => p.StudentAccount == studentid);

                    if (studentData != null)
                    {
                        studentData.FirstName   = studentWelcomeInfo.FirstName;
                        studentData.MiddleName  = studentWelcomeInfo.MiddleName;
                        studentData.LastName    = studentWelcomeInfo.LastName;
                        studentData.Gender      = studentWelcomeInfo.Gender;
                        studentData.CourseId    = studentWelcomeInfo.CourseId;
                        studentData.YearLevelId = studentWelcomeInfo.YearLevelId;
                        studentData.QuestionId  = studentWelcomeInfo.QuestionId;
                        studentData.Answer      = studentWelcomeInfo.Answer;
                    }

                    if (userData != null)
                    {
                        userData.DateUpdated = DateTime.Now;
                    }

                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 3
0
 public ActionResult UpdateInfo(StudentWelcomeInfo studentWelcomeInfo)
 {
     if (ModelState.IsValid)
     {
         UserManager usermanager = new UserManager();
         usermanager.UpdateStudentInfo(studentWelcomeInfo);
         ViewBag.Title = studentWelcomeInfo.FirstName;
     }
     return(View("Index"));
 }