course details changes done
This commit is contained in:
parent
1f7ab43831
commit
48f57757cd
134
Apollo/api/application/controllers/DayBookMaster_Controller.php
Normal file
134
Apollo/api/application/controllers/DayBookMaster_Controller.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: karthi
|
||||
* Date: 12/26/17
|
||||
* Time: 4:06 PM
|
||||
*/
|
||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
/**
|
||||
* This is an example of a few basic user interaction methods you could use
|
||||
* all done with a hardcoded array
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Rest Server
|
||||
* @category Controller
|
||||
* @author
|
||||
* @license MIT
|
||||
* @link
|
||||
*/
|
||||
class DayBookMaster_Controller extends REST_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Construct the parent class
|
||||
parent::__construct();
|
||||
|
||||
// Configure limits on our controller methods
|
||||
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
|
||||
$this->methods['addDaybookMasterDetails_post']['limit'] = 100; // 50 requests per hour per user/key
|
||||
$this->methods['getDayBookMasterDetails_post']['limit'] = 500; // 50 requests per hour per user/key
|
||||
$this->methods['updateDayBookMasterDetails_post']['limit'] = 500;
|
||||
// load the model
|
||||
$this->load->model('DaybookMaster_model', 'daybookmaster_model');
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* This method used to get day book master details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function addDaybookMasterDetails_post()
|
||||
{
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details['TypeID'] = $this->post('type');
|
||||
$details['TypeName'] = $this->post('name');
|
||||
$details['IsActive'] = $this->post('status');
|
||||
$details['CreatedBy'] = $this->post('createdBy');
|
||||
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
||||
$addDetails = $this->daybookmaster_model->addDetails($details);// Check if the users data store contains users (in case the database result returns NULL)
|
||||
if ($addDetails)
|
||||
{
|
||||
$addDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($addDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* This method used to get day book master details
|
||||
* created by kms
|
||||
* */
|
||||
public function getDayBookMasterDetails_post()
|
||||
{
|
||||
$requestedBy = $this->post('requestedBy');
|
||||
$getdetails = $this->daybookmaster_model->getDayBookDetails($requestedBy);
|
||||
|
||||
if ($getdetails)
|
||||
{
|
||||
$getdetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getdetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No records found!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* update the day book details
|
||||
* created by kms
|
||||
* */
|
||||
public function updateDayBookMasterDetails_post()
|
||||
{
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details['ID'] = $this->post('ID');
|
||||
$details['TypeName'] = $this->post('TypeName');
|
||||
$details['TypeID'] = $this->post('TypeID');
|
||||
$details['IsActive'] = $this->post('status');
|
||||
$details['UpdatedBy'] = $this->post('updatedBy');
|
||||
$details['UpdatedOn'] = $now->format("Y-m-d H:i:s");
|
||||
$updateDetails = $this->daybookmaster_model->updateDayBook($details);// Check if the users data store contains users (in case the database result returns NULL)
|
||||
|
||||
if ($updateDetails)
|
||||
|
||||
{
|
||||
$updateDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user