class FirmiesController < ApplicationController
  # GET /firmies
  # GET /firmies.json
  def index
    @firmies = Firmy.all

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

  # GET /firmies/1
  # GET /firmies/1.json
  def show
    @firmy = Firmy.find(params[:id])

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

  # GET /firmies/new
  # GET /firmies/new.json
  def new
    @firmy = Firmy.new

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

  # GET /firmies/1/edit
  def edit
    @firmy = Firmy.find(params[:id])
  end

  # POST /firmies
  # POST /firmies.json
  def create
    @firmy = Firmy.new(params[:firmy])

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

  # PUT /firmies/1
  # PUT /firmies/1.json
  def update
    @firmy = Firmy.find(params[:id])

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

  # DELETE /firmies/1
  # DELETE /firmies/1.json
  def destroy
    @firmy = Firmy.find(params[:id])
    @firmy.destroy

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