//public int Save(EnrollStudent enrollStudent) //{ // EnrollStudentGateway enrollStudentGateway = new EnrollStudentGateway(); // return enrollStudentGateway.Save(enrollStudent); //} public string Save(EnrollStudent enrollStudent) { EnrollStudent aenrollStudent = GetEnrollCourses.ToList() .Find( st => st.StudentId == enrollStudent.StudentId && st.CourseId == enrollStudent.CourseId); if (aenrollStudent == null) { if (enrollStudentGateway.Save(enrollStudent) > 0) { return("Saved Sucessfully!"); } return("Failed to save"); } return("This course already taken by the student"); }
public string Save(EnrollStudentInCourse enrollStudentInCourse) { EnrollStudentInCourse enrollStudent = GetEnrollCourses.ToList() .Find( st => (st.StudentId == enrollStudentInCourse.StudentId && st.CourseId == enrollStudentInCourse.CourseId) && (st.Status)); if (enrollStudent == null) { if (studentGateway.Insert(enrollStudentInCourse) > 0) { return("Saved Sucessfully!"); } return("Failed to save"); } return("This course already taken by the student"); }