25 lines
694 B
Go
25 lines
694 B
Go
package library
|
|
|
|
import (
|
|
"gitlab.thpeetz.de/kontor/kontor-go/pkg/dao"
|
|
"gitlab.thpeetz.de/kontor/kontor-go/pkg/util"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func showAuthorList(c *gin.Context) {
|
|
var authorDao = AuthorDAO{Db: dao.KontorDb}
|
|
if authors, err := authorDao.FindAll(); err == nil {
|
|
util.Render(c, gin.H{"title": "Author List", "payload": authors}, "library/authors.html")
|
|
}
|
|
}
|
|
|
|
func showBookList(c *gin.Context) {
|
|
var bookDao = BookDAO{Db: dao.KontorDb}
|
|
if books, err := bookDao.FindAll(); err == nil {
|
|
util.Render(c, gin.H{"title": "Book List", "payload": books}, "library/books.html")
|
|
} else {
|
|
util.Render(c, gin.H{"title": "Kontor", "payload": nil}, "kontor/index.html")
|
|
}
|
|
}
|