Commit 09151924 authored by Fjen Undso's avatar Fjen Undso
Browse files

save new votes and answers in sessions

parent 71980800
......@@ -17,7 +17,8 @@ public class QuestionController extends Controller {
if (!answer.owner.isEmpty()) {
QuestionAnswer inserted = new QuestionAnswer(session,
answer.owner, answer.answer);
inserted.save();
session.addQuestionAnswer(inserted);
session.save();
return created(Json.toJson(inserted));
} else {
return badRequest("owner missing");
......
......@@ -15,7 +15,8 @@ public class VoteController extends Controller {
if (!vote.owner.isEmpty()) {
Vote inserted = new Vote(session, vote.owner, vote.type,
vote.vote);
inserted.save();
session.addVote(inserted);
session.save();
return created(Json.toJson(inserted));
} else {
return badRequest("owner missing");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment