예제 #1
0
func deleteJobs(w rest.ResponseWriter, r *rest.Request) {
	s := r.PathParam("id")
	id, err := strconv.Atoi(s)
	if err != nil {
		return
	}
	RemoveJob(id)
	w.WriteHeader(http.StatusOK)
}
예제 #2
0
func putJobs(w rest.ResponseWriter, r *rest.Request) {
	s := r.PathParam("id")
	id, err := strconv.Atoi(s)
	if err != nil {
		return
	}

	model := payload(w, r)

	if model == nil {
		return
	}

	UpdateJob(id, model.Name, model.Expression, model.Command)
	model.Id = id
	w.WriteJson(model)
}