From 74d85fc8442c4efd4536af158c176c1e5eb478c0 Mon Sep 17 00:00:00 2001
From: Lukas Kimpel <lukas.kimpel@mni.thm.de>
Date: Fri, 16 Mar 2018 00:28:43 +0100
Subject: [PATCH] Implement submit function to add or edit text content

---
 .../creator-text-content.component.ts            | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/app/creator-text-content/creator-text-content.component.ts b/src/app/creator-text-content/creator-text-content.component.ts
index 0e65839c4..8d14247a0 100644
--- a/src/app/creator-text-content/creator-text-content.component.ts
+++ b/src/app/creator-text-content/creator-text-content.component.ts
@@ -1,5 +1,6 @@
 import { Component, OnInit } from '@angular/core';
 import { TextContent } from '../text-content';
+import { ContentService } from '../content.service';
 
 @Component({
   selector: 'app-creator-text-content',
@@ -10,19 +11,24 @@ export class CreatorTextContentComponent implements OnInit {
 
   content: TextContent = new TextContent('1',
     '1',
-    '1',
-    'Text Content 1',
-    'This is the body of Text Content 1',
+    '0',
+    '',
+    '',
     1);
 
-  constructor() {
+  constructor(private contentService: ContentService) {
   }
 
   ngOnInit() {
   }
 
   submitContent() {
-
+    if (this.content.contentId === '1') {
+      this.contentService.addContent(this.content).subscribe();
+    } else {
+      // ToDo: Implement function in service
+      // this.contentService.updateContent(this.content).subscribe();
+    }
   }
 
 }
-- 
GitLab