Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def insert = DBAction { implicit rs =>
- catForm.bindFromRequest.fold(
- badForm =>
- BadRequest(s"Form cannot be parsed, errors: ${badForm.errors}"),
- cat =>
- if (cats.filter(_.name === cat.name).exists.run) {
- BadRequest(s"A cat named ${cat.name} already exists")
- } else {
- cats.insert(cat)
- Redirect(routes.Application.index())
- }
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement