Skip to content

Instantly share code, notes, and snippets.

@dsugden
Created January 21, 2013 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsugden/4582884 to your computer and use it in GitHub Desktop.
Save dsugden/4582884 to your computer and use it in GitHub Desktop.
Create an article
def create(userId: Long, articleForCreation: ArticleForCreation): Try[ArticleId] = database.withSession { implicit db: Session =>
Try(
ArticleId(
ArticleTable.forInsert.insert(
Article(None,
articleForCreation.name,
articleForCreation.body,
userId,
new java.sql.Date(System.currentTimeMillis()),
articleForCreation.category.toString(),
articleForCreation.published,
-1,
None))))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment