import other kontor repos into directories
This commit is contained in:
committed by
Thomas Peetz
parent
28746adfbb
commit
b424e95e05
@@ -0,0 +1,28 @@
|
||||
package comics
|
||||
|
||||
import (
|
||||
"gitlab.thpeetz.de/kontor/kontor-go/pkg/dao"
|
||||
"gitlab.thpeetz.de/kontor/kontor-go/pkg/util"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func showComicList(c *gin.Context) {
|
||||
var dao = ComicDAO{Db: dao.KontorDb}
|
||||
if comics, err := dao.FindAll(); err == nil {
|
||||
util.Render(c, gin.H{"title": "Comics", "payload": comics}, "comics.html")
|
||||
} else {
|
||||
c.AbortWithError(http.StatusNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
func showComic(c *gin.Context) {
|
||||
var dao = ComicDAO{Db: dao.KontorDb}
|
||||
comicID := c.Param("comic_id")
|
||||
if comic, err := dao.FindByID(comicID); err == nil {
|
||||
util.Render(c, gin.H{"title": "Comic Details", "payload": comic, "action": util.SaveAction}, "comic.html")
|
||||
} else {
|
||||
c.AbortWithError(http.StatusNotFound, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user