get '/' do items = Item.all erb :index, :locals => { :title => 'Dashboard', :items => items } end get '/item' do redirect '/item/list' end get '/item/list' do items = Item.all erb :'item/list', :locals => { :title => 'List of Items', :items => items } end get '/item/create' do erb :'item/create', :locals => { :title => 'Create New Item' } end post '/item/create' do item = Item.create( name: params[:item_name], serial_number: params[:item_serial], sku_number: params[:item_sku], purchased_from: params[:item_purchase_from], purchased_at: params[:item_purchase_date], manufacturer: params[:item_manufacturer], type: params[:item_type] ) redirect "/item/#{item.id}" end