Exemplo n.º 1
0
func (ec EventsController) GetListOfSeatingRequestChoices(c web.C, w http.ResponseWriter, r *http.Request) {
	if choices, err := ec.es.GetListOfSeatingRequestChoices(c.URLParams["id"]); err != nil {
		w.WriteHeader(utils.GetCodeForError(err))
		fmt.Println(err)
	} else {
		w.WriteHeader(200)
		json.NewEncoder(w).Encode(choices)
	}
}
Exemplo n.º 2
0
// GetMenuItemsForEvent renders the menu items for an event using w.
func (ec EventsController) GetMenuItemsForEvent(c web.C, w http.ResponseWriter, r *http.Request) {
	if items, err := ec.es.GetMenuItemsForEvent(c.URLParams["id"]); err != nil {
		w.WriteHeader(utils.GetCodeForError(err))
		fmt.Println(err)
	} else {
		w.WriteHeader(200)
		json.NewEncoder(w).Encode(items)
	}
}
Exemplo n.º 3
0
// GetEventStats gets the stats for the specified event.
func (ec EventsController) GetEventStats(c web.C, w http.ResponseWriter, r *http.Request) {
	userID, ok := checkForAndHandleUserIDInContext(c, w, "You need a valid user id to get your list of events!")

	if !ok {
		return
	}

	if stats, err := ec.es.GetEventStats(c.URLParams["id"], userID); err != nil {
		w.WriteHeader(utils.GetCodeForError(err))
		fmt.Println(err)
	} else {
		w.WriteHeader(200)
		json.NewEncoder(w).Encode(stats)
	}
}