Last active
August 29, 2015 14:07
-
-
Save gbougeard/a22cac4b77a5dcd586be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class HotelQS(hotelId: Option[Long] = None, | |
country: Option[String] = None, | |
city: Option[String] = None, | |
zipcode: Option[String] = None) | |
object HotelQS { | |
implicit val hotelMapping: Mapping[HotelQS] = | |
mapping( | |
"hotelId" -> optional(longNumber), | |
"country" -> optional(text), | |
"city" -> optional(text), | |
"zipcode" -> optional(text) | |
)(HotelQS.apply)(HotelQS.unapply) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list(filter : HotelQS, page: Int =0, orderBy: Int=0) = Action { | |
implicit request => | |
val hotels = models.Hotels.findPage(page, orderBy, filter) | |
render { | |
case Accepts.Html() => Ok(views.html.it.hotels.list("List hotels", hotels, orderBy, filter)) | |
case Accepts.Json() => Ok(Json.toJson(hotels)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /hotels controllers.Hotels.list(q:binders.HotelQS?=new binders.HotelQS, p:Int ?= 0,s:Int ?= 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment