blob: 50936139376d23a0e2e18068a21363bfe77fc2cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Used to show a all categories
package categories
import (
"net/http"
"soko/pkg/database"
"soko/pkg/models"
)
// Index renders a template to show all categories
func Index(w http.ResponseWriter, r *http.Request) {
var categories []*models.Category
err := database.DBCon.Model(&categories).Order("name ASC").Select()
if err != nil {
http.NotFound(w, r)
return
}
renderCategoryTemplate("index", createCategoriesData(categories), w)
}
|