# Copyright (c) 2012 Bingo Entreprenøren AS # Copyright (c) 2012 Teknobingo Scandinavia AS # Copyright (c) 2012 Knut I. Stenmark # Copyright (c) 2012 Patrick Hanevold # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. class ClientsController < ApplicationController # GET /clients # GET /clients.json def index @clients = Client.all respond_to do |format| format.html # index.html.erb format.json { render json: @clients } end end # GET /clients/1 # GET /clients/1.json def show respond_to do |format| format.html # show.html.erb format.json { render json: @client } end end # GET /clients/new # GET /clients/new.json def new respond_to do |format| format.html # new.html.erb format.json { render json: @client } end end # POST /clients # POST /clients.json def create respond_to do |format| if @client.save format.html { redirect_to @client, notice: 'Client was successfully created.' } format.json { render json: @client, status: :created, location: @client } else format.html { render action: "new" } format.json { render json: @client.errors, status: :unprocessable_entity } end end end # PUT /clients/1 # PUT /clients/1.json def update respond_to do |format| if @client.update_attributes(params[:client]) format.html { redirect_to @client, notice: 'Client was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @client.errors, status: :unprocessable_entity } end end end # DELETE /clients/1 # DELETE /clients/1.json def destroy @client = Client.find(params[:id]) @client.destroy respond_to do |format| format.html { redirect_to clients_url } format.json { head :no_content } end end end