Class: Logistics::Core::AgencyCategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/logistics/core/agency_categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /agency_categories POST /agency_categories.json



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/logistics/core/agency_categories_controller.rb', line 16

def create
  @agency_category = AgencyCategory.new(agency_category_params)
  if @agency_category.save
    response = Mks::Common::MethodResponse.new(true, "Agency Category information saved successfully!", @agency_category, nil, nil)
  else
    errors = Mks::Common::Util.error_messages @agency_category, "Agency Category"
    response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil)
  end
  render json: response
end

#indexObject

GET /agency_categories GET /agency_categories.json



8
9
10
11
12
# File 'app/controllers/logistics/core/agency_categories_controller.rb', line 8

def index
  agency_categories = AgencyCategory.all
  response = Mks::Common::MethodResponse.new(true, nil, agency_categories, nil, nil)
  render json: response
end

#updateObject

PATCH/PUT /agency_categories/1 PATCH/PUT /agency_categories/1.json



29
30
31
32
33
34
35
36
37
# File 'app/controllers/logistics/core/agency_categories_controller.rb', line 29

def update
  if @agency_category.update(agency_category_params)
    response = Mks::Common::MethodResponse.new(true, "Agency Category information updated successfully!", @agency_category, nil, nil)
  else
    errors = Mks::Common::Util.error_messages @agency_category, "Agency Category"
    response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil)
  end
  render json: response
end