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

class Admin::IWebsitesController < ApplicationController
  layout "admin"
  before_filter :auth_admin

  before_filter :admin_space
  
  def admin_space
    @admin_space = "stocks"
  end
  

  
  
  def index
    @i_websites = IWebsite.order(:name).all

   
  end

  def show
    @i_website = IWebsite.find(params[:id])

  end

  def new
    
    
		@i_website = IWebsite.new
    

  end

 

  def edit
  
    
    @i_website = IWebsite.find(params[:id])
  end

  def create
    @i_website = IWebsite.new(params.require(:i_website).permit!)


    if @i_website.save
     @i_websites = IWebsite.order(:name).all
      
    else
      render action: "new"
 
    end

  end


  def update
    @i_website = IWebsite.find(params[:id])


    if @i_website.update_attributes(params.require(:i_website).permit!)
      
       @i_websites = IWebsite.order(:name).all
    else
     render action: "edit" 
      
    end
      
  end


  def destroy
    @i_website = IWebsite.find(params[:id])
    @i_website.destroy
    
    
  end
end
