public string EnrollCourse(EnrollCourse enrollCourse) { List <EnrolledCourseByStudent> enrolledCourseByStudents = GetAllEnrolledCourseByStudents(); int count = 0; foreach (var course in enrolledCourseByStudents) { if (course.CourseId == enrollCourse.CourseId) { if (course.RegNo == enrollCourse.RegNo) { count = 1; break; } } } if (count == 1) { return("Selected courses is already enrolled by this student."); } else { if (studentGateway.EnrollCourse(enrollCourse) > 0) { return("Course Enrolled SuccessFully"); } return("Course Enroll Failed."); } }
internal dynamic EnrollCourse(EnrollCourse aEnrollCourse) { if (aStudentGateway.EnrolledCourseExist(aEnrollCourse.CourseId)) { return("Course Already Enrolled"); } else if (aStudentGateway.EnrollCourse(aEnrollCourse) > 0) { return("Enrolled Successfull"); } else { return("Enrolled failed"); } }
// ENROLL COURSE public string EnrollCourse(EnrollStudent enroll) { if (studentGateway.IsEnrolled(enroll)) { return("Exists"); } else { int rowsAffected = studentGateway.EnrollCourse(enroll); if (rowsAffected > 0) { return("Success"); } else { return("Failed"); } } }
public string EnrollCourse(Student student) { string message = ""; int rowAffected = 0; if (!studentGateway.IsCourseEnrolled(student)) { string status = studentGateway.IsCourseAssigned(student); if (status == "unassign") { rowAffected = studentGateway.UpdateEnrollCourse(student); if (rowAffected > 0) { message = "Congratulations! Course enrolled"; } else { message = "Sorry! Course is not enrolled"; } return(message); } student.Grade = "Not Graded Yet"; rowAffected = studentGateway.EnrollCourse(student); if (rowAffected > 0) { message = "Congratulations! Course enrolled"; } else { message = "Sorry! Course is not enrolled"; } } else { message = "Course already enrolled"; } return(message); }