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

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

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

  end

  def show
    @price_line_block = PriceLineBlock.find(params[:id])

  end

  def new
    @price_line_block = PriceLineBlock.new
  
  end

  def edit
    @price_line_block = PriceLineBlock.find(params[:id])
    
  end

  def create
    @price_line_block = PriceLineBlock.new(params.require(:price_line_block).permit!)

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

  end


  def update
    @price_line_block = PriceLineBlock.find(params[:id])


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


  def destroy
    @price_line_block = PriceLineBlock.find(params[:id])
    @price_line_block.destroy
    
  end
end
