Example #1
0
func view(w http.ResponseWriter, r *http.Request) {

	id, _ := strconv.Atoi(r.FormValue("id"))

	c := appengine.NewContext(r)

	var view detail_view

	// グループ情報を取得
	if group, err := model.GetGroup(c, id); err != nil {
		http.Error(w, err.String(), http.StatusInternalServerError)
		return
	} else {
		view.Group = group
	}

	// メンバー情報を取得
	if memberlist, err := model.MemberList(c, id); err != nil {
		http.Error(w, err.String(), http.StatusInternalServerError)
		return
	} else {
		view.Member = memberlist
	}

	// 詳細画面を表示
	if err := detailTemplate.Execute(w, view); err != nil {
		http.Error(w, err.String(), http.StatusInternalServerError)
	}
}
Example #2
0
func edit(w http.ResponseWriter, r *http.Request) {
	var view view_group
	view.URL = "/add/update"

	c := appengine.NewContext(r)

	id, _ := strconv.Atoi(r.FormValue("id"))

	// 勉強会情報を取得
	if group, err := model.GetGroup(c, id); err != nil {
		http.Error(w, err.String(), http.StatusInternalServerError)
		return
	} else {
		view.Group = group
	}

	// 勉強会情報の登録画面を表示する。
	if err := groupAddTemplate.Execute(w, view); err != nil {
		http.Error(w, err.String(), http.StatusInternalServerError)
	}
}