Created
April 26, 2011 19:05
-
-
Save wfaler/942873 to your computer and use it in GitHub Desktop.
simplecomposition
This file contains hidden or 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
MyController extends Controller with ParameterMapper with Renderable{ | |
post("/widgets/")((request, response) => { | |
mapRequest[Widget](request)(widget => { | |
render(WidgetService.save(widget)) | |
}) | |
}) | |
} | |
object WidgetService extends Validations{ | |
def save(widget: Widget): Widget = { | |
validations(widget){ | |
val validator = new WidgetValidator(widget) | |
validator.add(new UniqueValidator({widget.id})) | |
validator.validate | |
} | |
dao.persist(widget) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment