Created
November 10, 2013 20:33
-
-
Save taywils/7403558 to your computer and use it in GitHub Desktop.
spark_blog_step_3_2
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
post(new Route("/article/update/:id") { | |
@Override | |
public Object handle(Request request, Response response) { | |
String title = request.queryParams("article-title"); | |
String summary = request.queryParams("article-summary"); | |
String content = request.queryParams("article-content"); | |
Integer id = Integer.parseInt(request.queryParams("article-id")); | |
for(Article article : HelloSpark.articles) { | |
if(id.equals(article.getId())) { | |
article.setTitle(title); | |
article.setContent(content); | |
article.setSummary(summary); | |
} | |
} | |
response.status(200); | |
response.redirect("/"); | |
return ""; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment