class KlientisController < ApplicationController
  skip_before_filter :autorizacia    

  # GET /klientis
  # GET /klientis.json
  def index
    @klientis = Klienti.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @klientis }
    end
  end

  # GET /klientis/1
  # GET /klientis/1.json
  def show
    @klienti = Klienti.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @klienti }
    end
  end

  # GET /klientis/new
  # GET /klientis/new.json
  def new
    @klienti = Klienti.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @klienti }
    end
  end

  # GET /klientis/1/edit
  def edit
    @klienti = Klienti.find(params[:id])
  end

  # POST /klientis
  # POST /klientis.json
  def create
    @klienti = Klienti.new(params[:klienti])

    respond_to do |format|
      if @klienti.save
        format.html { redirect_to @klienti, notice: 'Klienti was successfully created.' }
        format.json { render json: @klienti, status: :created, location: @klienti }
      else
        format.html { render action: "new" }
        format.json { render json: @klienti.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /klientis/1
  # PUT /klientis/1.json
  def update
    @klienti = Klienti.find(params[:id])

    respond_to do |format|
      if @klienti.update_attributes(params[:klienti])
        format.html { redirect_to @klienti, notice: 'Klienti was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @klienti.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /klientis/1
  # DELETE /klientis/1.json
  def destroy
    @klienti = Klienti.find(params[:id])
    @klienti.destroy

    respond_to do |format|
      format.html { redirect_to klientis_url }
      format.json { head :no_content }
    end
  end
end
