Esempio n. 1
0
func handleCreateIncident(w http.ResponseWriter, r *http.Request) {
	err := r.ParseForm()
	if err != nil {
		http.Error(w, http.StatusText(500), 500)
	}
	incident := domain.Incident{Values: make(map[string]interface{})}
	for k, v := range r.Form {
		incident.Values[k] = v[0]
	}
	incident.Status = domain.Draft
	db.SaveIncident(incident)
	http.Redirect(w, r, "/", 301)
}