# -*- encoding : utf-8 -*-

class Admin::PCustomerProductPricesController < ApplicationController
  layout "admin"
  before_action :auth_admin

  before_action :admin_space
  
  def admin_space
    @admin_space = "default"
  end
  
  def index
    @p_customer_product_prices = PCustomerProductPrice.order(:name).all

  end

  def show
    @p_customer_product_price = PCustomerProductPrice.find(params[:id])

  end

  def new
    @p_customer_product_price = PCustomerProductPrice.new
  
  end

  def edit
    @p_customer_product_price = PCustomerProductPrice.find(params[:id])
    
  end

  def create
    @p_customer_product_price = PCustomerProductPrice.new(params.require(:p_customer_product_price).permit!)

    if @p_customer_product_price.save
      
    else
      render action: "new"
 
    end

  end


  def update
    @p_customer_product_price = PCustomerProductPrice.find(params[:id])


    if @p_customer_product_price.update_attributes(params.require(:p_customer_product_price).permit!)
      
    else
     render action: "edit" 
      
    end
      
  end


  def destroy
    @p_customer_product_price = PCustomerProductPrice.find(params[:id])
    @p_customer_product_price.destroy
    
  end
end
