Example #1
0
func createScriptAction(r render.Render, repo script.ScriptRepository, request *http.Request) {
	sType := request.FormValue("type")
	title := request.FormValue("title")
	body := request.FormValue("body")

	repo.Save(script.Script{0, script.ScriptType(sType), title, body, true})

	r.Redirect("/script", 302)
}
Example #2
0
func updateScriptAction(r render.Render, repo script.ScriptRepository, params martini.Params, request *http.Request) {
	id, _ := strconv.ParseInt(params["id"], 0, 64)
	sType := request.FormValue("type")
	title := request.FormValue("title")
	body := request.FormValue("body")

	repo.Save(script.Script{int(id), script.ScriptType(sType), title, body, true})

	r.Redirect("/script", 302)
}