From 22112eb9b6272b2c7f4400aed97f7430f2e1ed28 Mon Sep 17 00:00:00 2001
From: Lukas Kimpel <lukas.kimpel@mni.thm.de>
Date: Thu, 15 Mar 2018 23:24:18 +0100
Subject: [PATCH] Implement submit function to add answers as a participant

---
 .../participant-text-content.component.ts          | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/app/participant-text-content/participant-text-content.component.ts b/src/app/participant-text-content/participant-text-content.component.ts
index efb026006..96fa89e45 100644
--- a/src/app/participant-text-content/participant-text-content.component.ts
+++ b/src/app/participant-text-content/participant-text-content.component.ts
@@ -1,5 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { TextContent } from '../text-content';
+import { ContentAnswerService } from '../content-answer.service';
+import { AnswerText } from '../answer-text';
 
 @Component({
   selector: 'app-participant-text-content',
@@ -14,12 +16,22 @@ export class ParticipantTextContentComponent implements OnInit {
     'This is the body of Text Content 1',
     1);
 
-  constructor() {
+  constructor(private answerService: ContentAnswerService) {
   }
 
   ngOnInit() {
   }
 
   submit(answer: string) {
+    this.answerService.addAnswerText({
+      id: '0',
+      revision: this.content.revision,
+      contentId: this.content.contentId,
+      round: this.content.round,
+      subject: this.content.subject,
+      body: answer,
+      read: 'false',
+      creationTimestamp: new Date()
+    } as AnswerText).subscribe();
   }
 }
-- 
GitLab