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

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

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

  end

  def show
    @p_product_feature = PProductFeature.find(params[:id])

  end

  def new
    @p_product_feature = PProductFeature.new
  
  end

  def edit
    @p_product_feature = PProductFeature.find(params[:id])
    
  end

  def create
    @p_product_feature = PProductFeature.new(params.require(:p_product_feature).permit!)

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

  end


  def update
    @p_product_feature = PProductFeature.find(params[:id])


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


  def destroy
    @p_product_feature = PProductFeature.find(params[:id])
    @p_product_feature.destroy
    
  end
end
