diff --git a/Apollo/api/application/models/Course_model.php b/Apollo/api/application/models/Course_model.php new file mode 100644 index 00000000..1379ccb4 --- /dev/null +++ b/Apollo/api/application/models/Course_model.php @@ -0,0 +1,111 @@ +db->select('CourseID'); + $this->db->where('CourseID', $arrayDetails['CourseID']); + if($this->db->get(COURSE)->first_row()){ + $result['courseStatus'] = false; + $result['message'] = "This course id is already exist!"; + } else { + $this->db->insert(COURSE, $arrayDetails); + if ($this->db->affected_rows() == '1') { + + $result['courseStatus'] = true; + $result['message'] = "Successfully course details added"; + } else { + $result['courseStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + return $result; + + } + + + /* + * get branch details + * parama id + * created by kms + * */ + + public function getCourse() + { + $this->db->select('CU.CourseID,CU.CourseName,CU.IsActive,US.UniversityID,US.UniversityName'); + $this->db->from(COURSE.' as CU'); + $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); + $this->db->order_by('CourseID','DESC'); + $courseDetails = $this->db->get(); + + if($courseDetails->result()){ + + $result['courseStatus'] = true; + $result['details'] = $courseDetails->result(); + } + else { + $result['courseStatus'] = false; + $result['message'] = "No records found!"; + } + + $result['universityDetails'] = $this->getUniversityDetails(); + + return $result; + + } + + /* + * update course details + * created by kms + * */ + public function updateCourse($arrayDetails=null) + { + $this->db->where('CourseID',$arrayDetails['CourseID']); + $upateStatus=$this->db->update(COURSE, $arrayDetails); + if($upateStatus){ + + $result['courseStatus'] = true; + $result['message'] = "Successfully course details updated"; + } + + else { + $result['courseStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + + } + + + return $result; + + } + /* + * get university details + * created by kms + * */ + public function getUniversityDetails() + { + $this->db->select('UniversityID,UniversityName'); + $this->db->order_by('UniversityID','ASC'); + $this->db->order_by('IsActive','1'); + $universityDetails = $this->db->get(UNIVERSITY); + return $universityDetails->result(); + } + + + +} \ No newline at end of file