public ActionResult Create([Bind(Include = "firstName,lastName,studentID,UHCLEmail,admittedSemester,currentSemester,majorName,CGPA,enrolledCoursesAndSemesters,completedCoursesAndGrades,ProgramCompletionType,AssignedFoundation")] StudentDetail studentDetail) { if (ModelState.IsValid) { db.StudentDetails.Add(studentDetail); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studentDetail)); }
public void updateStudentDetails(string studentId, List <Course> assignedFoundationClasses, string facultyAd) { string cShtName; List <string> list = new List <string>(); string foundationsString = ""; if (assignedFoundationClasses != null) { foreach (Course c in assignedFoundationClasses) { cShtName = c.CourseShortName; list.Add(cShtName); } foundationsString = string.Join(",", list.ToArray()); } using (CPSCreationEntities db = new CPSCreationEntities()) { var result = db.StudentDetails.SingleOrDefault(b => b.studentID == studentId); if (result != null) { result.AssignedFoundation = foundationsString; result.AssignedFacultyAdvisor = facultyAd; db.SaveChanges(); } } }//end of updateStudentDetails
}//end of updateStudentDetails public void updateFacultyDetails(string studentId, string facultyName) { string firstNameFaculty = ""; string[] words = facultyName.Split(' '); firstNameFaculty = words[0]; string studentListStr = studentId + ","; using (CPSCreationEntities db = new CPSCreationEntities()) { Boolean flag = false; var result = db.FacultyDetails.SingleOrDefault(b => b.First_Name == firstNameFaculty); if (result != null) { var check = result.AdvisingStudentList; if (check != null) { flag = true; } if (flag) { if (result.AdvisingStudentList.Contains(studentListStr)) { result.AdvisingStudentList = result.AdvisingStudentList; } else { result.AdvisingStudentList += studentListStr; } } else { result.AdvisingStudentList = studentListStr; } db.SaveChanges(); } } }