Class: Mks::Rate::ServiceDeliveryUnitsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mks/rate/service_delivery_units_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
# File 'app/controllers/mks/rate/service_delivery_units_controller.rb', line 11

def create
  sdu = ServiceDeliveryUnit.new(service_delivery_unit_params)
  if sdu.save
    render json: Mks::Common::MethodResponse.success_response(sdu, 'Service delivery unit saved successfully !')
  else
    render json: Mks::Common::MethodResponse.failure_response(sdu), status: :unprocessable_entity
  end
end

#indexObject



6
7
8
9
# File 'app/controllers/mks/rate/service_delivery_units_controller.rb', line 6

def index
  result = ServiceDeliveryUnit.all
  render json: result
end

#updateObject



20
21
22
23
24
25
26
# File 'app/controllers/mks/rate/service_delivery_units_controller.rb', line 20

def update
  if @sdu.update(service_delivery_unit_params)
    render json: Mks::Common::MethodResponse.success_response(@sdu, 'Service delivery unit updated successfully !')
  else
    render json: Mks::Common::MethodResponse.failure_response(@sdu), status: :unprocessable_entity
  end
end