Class: Logistics::Core::StandardRemarksController

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

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/logistics/core/standard_remarks_controller.rb', line 12

def create
  standard_remark = StandardRemark.new(standard_remark_params)
  if standard_remark.save
    res = Mks::Common::MethodResponse.new(true, 'Remark added successfully !', nil, nil, nil)
  else
    errors = Mks::Common::Util.error_messages('Standard Remark', standard_remark)
    res = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil)
  end
  render json: res
end

#indexObject



7
8
9
10
# File 'app/controllers/logistics/core/standard_remarks_controller.rb', line 7

def index
  standard_remarks = StandardRemark.all
  render json: Mks::Common::MethodResponse.new(true, nil, standard_remarks, nil, nil)
end

#updateObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/logistics/core/standard_remarks_controller.rb', line 23

def update
  if @standard_remark.update(standard_remark_params)
    res = Mks::Common::MethodResponse.new(true, 'Remark updated successfully !', nil, nil, nil)
  else
    errors = Mks::Common::Util.error_messages(@standard_remark, 'Standard Remark')
    res = Mks::Common::MethodResponse.new(false, nil, nil, errors, nil)
  end
  render json: res
end