``` <http://app.post|app.post>("/new-book-manual...
# codereview
h
Copy code
<http://app.post|app.post>("/new-book-manual") manual@{ ctx ->
    val title = ctx.formParam("title")
    val author = ctx.formParam("author")
    val edition = ctx.formParam("edition")
    val publisher = ctx.formParam("publisher")
    val subjects = ctx.formParam("subjects")
    val binding = ctx.formParam("binding")
    val publishDate = ctx.formParam("publish-date")
    val overview = ctx.formParam("overview")
    
    if (title == null || author == null) {
      ctx.html("An error has occurred. Please provide a Title and an Author.")
      return@manual
    }
    
    val props = mutableListOf(title, author, edition, publisher, subjects, binding, publishDate, overview)
    
    for (i in 0 until props.size) if (props[i] == "") props[i] = null
    
    BookRepo.add(Book(title, author,
                      edition, publisher,
                      subjects, binding,
                      publishDate, overview))
    
    ctx.html("Book has been added!")
    
  }