public Message Save(Student newStudent)
        {
            Message message = new Message();
            bool isStudentExists = IsStudentExists(newStudent);

            if (isStudentExists)
            {
                message.Status = "warning";
                message.Details = "Registration Number is already exists.";
                return message;
            }

            StudentGateway aStudentGateway = new StudentGateway();
            int totalRowsAffected = aStudentGateway.AddStudent(newStudent);
            if (totalRowsAffected > 0)
            {
                message.Status = "success";
                message.Details = "Data Saved Successfully";
            }
            else
            {
                message.Status = "error";
                message.Details = "Operation Failed.";
            }

            return message;
        }
        private bool IsStudentExists(Student newStudent)
        {
            StudentGateway aStudentGateway = new StudentGateway();

            Student aStudent = aStudentGateway.GetStudentByRegNo(newStudent.RegNo);

            if (aStudent != null)
            {
                return true;
            }
            return false;
        }
 public Student GetStudentByRegNo(string regNo)
 {
     StudentGateway aStudentGateway = new StudentGateway();
     Student student = aStudentGateway.GetStudentByRegNo(regNo);
     return student;
 }
 public List<Student> GetAll()
 {
     StudentGateway aStudentGateway = new StudentGateway();
     List<Student> students = aStudentGateway.GetAll();
     return students;
 }