class Admin::PortfoliosController < ApplicationController
  layout "admin"
  
  before_filter :authenticate_admin!
  
  def index
    
    @portfolios = Portfolio.all
  end


  def show
    @portfolio = Portfolio.find(params[:id])

  end


  def new
    @portfolio = Portfolio.new
  
  end

  def edit
    @portfolio = Portfolio.find(params[:id])
  
  end

  def create
  	@portfolio = Portfolio.new(params[:portfolio])
    
    if @portfolio.save
      redirect_to admin_portfolios_path
          
  	else
  		render :action => "new" 
  	end
  end

  def update
  	@portfolio = Portfolio.find(params[:id])
    
    if @portfolio.update_attributes(params[:portfolio])
      redirect_to admin_portfolios_path
          
  	else
  		render :action => "edit" 
  	end
    
  end
  		


  def destroy
  	@portfolio = Portfolio.find(params[:id])
	  @portfolio.destroy
    redirect_to admin_portfolios_path

  end



end
