public bool AddStudent(StudentModel sModel) { //TODO if user exist not insert StudentLogic studentLogicBL = new StudentLogic(); StudentsDetail studentsDetailList = new StudentsDetail(); studentsDetailList.UserName = sModel.UserName; //Encrypt Password var keyNew = EncryptUtility.GeneratePassword(10); var encryptPassword = EncryptUtility.EncodePassword(sModel.Password, keyNew); studentsDetailList.Password = encryptPassword; studentsDetailList.student_first_name = sModel.FirstName; studentsDetailList.student_last_name = sModel.LastName; studentsDetailList.student_middle_name = sModel.MiddleName; studentsDetailList.student_address1 = sModel.Address_Line1; studentsDetailList.student_city = sModel.City; studentsDetailList.student_country = sModel.Country; studentsDetailList.student_email = sModel.Email; studentsDetailList.student_graduation_year = sModel.GraduationYear; studentsDetailList.student_id = sModel.StudentId; studentsDetailList.is_international_student = sModel.isInternationStudent; studentsDetailList.date_created = DateTime.Now; return(studentLogicBL.AddStudent(studentsDetailList)); //return false; }
private static void CreateStudent() { Console.WriteLine("********* Create student *********"); int studentId = UI.Menu.ReadNumber("Student Id: "); string studentEmail = UI.Menu.ReadEmail(); try { studentLogic.AddStudent(studentId, studentEmail); logs.SendTimestamp("CreateStudent", "admin", "Student registered: " + studentId); Console.WriteLine("Student created correctly"); } catch (StudentException e) { Console.WriteLine(e.Message); Console.WriteLine("Try again please."); CreateStudent(); } }
public IActionResult AddStudent(Student student) { if (ModelState.IsValid) { Student student1 = _studentLogic.AddStudent(student); if (student1 != null) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("Error", "Error in adding Student"); return(View()); } } else { ModelState.AddModelError("Error", "Validation Error"); return(View()); } }
public void AddStudent(StudentC []stdc) { try { StudentLogic sl = new StudentLogic(); Student[] std = new Student[stdc.Length]; for (int i = 0; i < stdc.Length; i++) { std[i] = new Student(); std[i].Name = stdc[i].Name; std[i].DOB = stdc[i].DOB; std[i].GPA = stdc[i].GPA; std[i].Active = stdc[i].Active; } sl.AddStudent(std); } catch (Exception exc) { throw exc; } }
public void AddStudent(StudentC [] stdc) { try { StudentLogic sl = new StudentLogic(); Student[] std = new Student[stdc.Length]; for (int i = 0; i < stdc.Length; i++) { std[i] = new Student(); std[i].Name = stdc[i].Name; std[i].DOB = stdc[i].DOB; std[i].GPA = stdc[i].GPA; std[i].Active = stdc[i].Active; } sl.AddStudent(std); } catch (Exception exc) { throw exc; } }