예제 #1
0
func saveHandler(rw http.ResponseWriter, req *http.Request) {
	err := req.ParseForm()
	common.CheckError(err)
	form := req.Form

	retailer := Retailer{
		Name:    common.IssetInForm(form["name"], 0),
		Website: common.IssetInForm(form["website"], 0),
	}

	insertRetailer(retailer)

	http.Redirect(rw, req, "add", http.StatusFound)
}
예제 #2
0
func saveHandler(rw http.ResponseWriter, req *http.Request) {
	err := req.ParseForm()
	common.CheckError(err)
	form := req.Form

	state := State{
		Name:    common.IssetInForm(form["name"], 0),
		Acronym: common.IssetInForm(form["acronym"], 0),
	}

	insertState(state)

	http.Redirect(rw, req, "add", http.StatusFound)
}
func saveHandler(rw http.ResponseWriter, req *http.Request) {
	err := req.ParseForm()
	common.CheckError(err)
	form := req.Form

	ticket := Ticket{
		Price:      common.IssetInForm(form["price"], 0),
		ConcertId:  common.IssetInForm(form["concert_id"], 0),
		RetailerId: common.IssetInForm(form["retailer_id"], 0),
		Timestamp:  common.IssetInForm(form["datetime"], 0),
	}

	insertTicket(ticket)

	http.Redirect(rw, req, "add", http.StatusFound)
}
func saveHandler(rw http.ResponseWriter, req *http.Request) {
	err := req.ParseForm()
	common.CheckError(err)
	form := req.Form

	stateId, err := strconv.ParseInt(common.IssetInForm(form["state_id"], 0), 10, 64)
	common.CheckError(err)

	concert := Concert{
		Name:    common.IssetInForm(form["name"], 0),
		Address: common.IssetInForm(form["address"], 0),
		StateId: stateId,
		Website: common.IssetInForm(form["website"], 0),
		Start:   common.IssetInForm(form["start"], 0),
		End:     common.IssetInForm(form["end"], 0),
	}

	insertConcert(concert)

	http.Redirect(rw, req, "add", http.StatusFound)
}