create productCommission
This commit is contained in:
74
app/controllers/origami/product_commissions_controller.rb
Normal file
74
app/controllers/origami/product_commissions_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Origami::ProductCommissionsController < ApplicationController
|
||||
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /product_commissions
|
||||
# GET /product_commissions.json
|
||||
def index
|
||||
@product_commissions = ProductCommission.all
|
||||
end
|
||||
|
||||
# GET /product_commissions/1
|
||||
# GET /product_commissions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /product_commissions/new
|
||||
def new
|
||||
@product_commission = ProductCommission.new
|
||||
end
|
||||
|
||||
# GET /product_commissions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /product_commissions
|
||||
# POST /product_commissions.json
|
||||
def create
|
||||
@product_commission = ProductCommission.new(product_commission_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @product_commission.save
|
||||
format.html { redirect_to @product_commission, notice: 'Product commission was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @product_commission }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @product_commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /product_commissions/1
|
||||
# PATCH/PUT /product_commissions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @product_commission.update(product_commission_params)
|
||||
format.html { redirect_to @product_commission, notice: 'Product commission was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @product_commission }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @product_commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /product_commissions/1
|
||||
# DELETE /product_commissions/1.json
|
||||
def destroy
|
||||
@product_commission.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to product_commissions_url, notice: 'Product commission was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_product_commission
|
||||
@product_commission = ProductCommission.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def product_commission_params
|
||||
params.fetch(:product_commission, {})
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user