Guest User

Untitled

a guest
Mar 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def update(id: Long): Action[AnyContent] = Action.async { implicit request =>
  2. topicForm.bindFromRequest.fold(
  3. formWithErrors => Future.successful(BadRequest(html.editForm(id, formWithErrors))),
  4. topic => {
  5. val futureTopUpdate = dao.update(id, topic.copy(id = Some(id)))
  6. futureTopUpdate.map { result =>
  7. Home.flashing("success" -> "Topic %s has been updated".format(topic.code))
  8. }.recover {
  9. case ex: TimeoutException =>
  10. Logger.error("Problem found in topic update process")
  11. InternalServerError(ex.getMessage)
  12. }
  13. })
  14. }
  15.  
  16. override def update(id: Long, topic: Topic): Future[Int] =
  17. try db.run(filterQuery(id).update(topic))
  18. finally db.close
Add Comment
Please, Sign In to add comment