Deleting a reservation
This commit is contained in:
		@ -630,3 +630,15 @@ func (m *Repository) AdminProcessReservation(w http.ResponseWriter, r *http.Requ
 | 
			
		||||
 | 
			
		||||
	http.Redirect(w, r, fmt.Sprintf("/admin/reservations-%s", src), http.StatusSeeOther)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AdminDeleteReservation deletes a reservation
 | 
			
		||||
func (m *Repository) AdminDeleteReservation(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	id, _ := strconv.Atoi(chi.URLParam(r, "id"))
 | 
			
		||||
	src := chi.URLParam(r, "src")
 | 
			
		||||
 | 
			
		||||
	_ = m.DB.DeleteReservation(id)
 | 
			
		||||
 | 
			
		||||
	m.App.Session.Put(r.Context(), "flash", fmt.Sprintf("Reservation %d deleted", id))
 | 
			
		||||
 | 
			
		||||
	http.Redirect(w, r, fmt.Sprintf("/admin/reservations-%s", src), http.StatusSeeOther)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user