Class: Logistics::Core::EslTransportTariffsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::EslTransportTariffsController
- Defined in:
- app/controllers/logistics/core/esl_transport_tariffs_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/logistics/core/esl_transport_tariffs_controller.rb', line 13 def create @esl_transport_tariff = EslTransportTariff.new(esl_transport_tariff_params) if @esl_transport_tariff.save response = Mks::Common::MethodResponse.new(true, 'ESL transport tariff saved successfully!', @esl_transport_tariff, nil, nil) else errors = Mks::Common::Util. @esl_transport_tariff, 'ESL transport tariff' response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end |
#index ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/logistics/core/esl_transport_tariffs_controller.rb', line 6 def index esl_transport_tariffs = EslTransportTariff.includes(:route) data = ApplicationRecord.as_json(esl_transport_tariffs) response = Mks::Common::MethodResponse.new(true, nil, data, nil, nil) render json: response end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/logistics/core/esl_transport_tariffs_controller.rb', line 24 def update if @esl_transport_tariff.update(esl_transport_tariff_params) response = Mks::Common::MethodResponse.new(true, "ESL transport tariff updated successfully!", @esl_transport_tariff, nil, nil) else errors = Mks::Common::Util. @esl_transport_tariff, "ESL transport tariff" response = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil) end render json: response end |