summaryrefslogtreecommitdiff
path: root/DSACore/Controllers/CommandsController.cs
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-09-27 00:31:30 +0200
committerTrueDoctor <d-kobert@web.de>2018-09-27 00:31:30 +0200
commitcd4785347eb641a0fab1a7157d701dd5d8c3259f (patch)
tree30ffcea7337231f84c47d45316babf45c24c3682 /DSACore/Controllers/CommandsController.cs
parent19bf37de7642ae8cdefd8fc6b4fadac3ac96ea9b (diff)
hoked the command handler up to the web api
modified file locations
Diffstat (limited to 'DSACore/Controllers/CommandsController.cs')
-rw-r--r--DSACore/Controllers/CommandsController.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/DSACore/Controllers/CommandsController.cs b/DSACore/Controllers/CommandsController.cs
index bda8fd0..7e078b2 100644
--- a/DSACore/Controllers/CommandsController.cs
+++ b/DSACore/Controllers/CommandsController.cs
@@ -14,25 +14,34 @@ namespace DSACore.Controllers
{
// GET: api/<controller>
[HttpGet]
- public IEnumerable<string> Get()
+ public string Get()
{
- return new string[] { "value1", "value2" };
+ return "Dies ist die supa dolle Web Api";
}
// GET api/<controller>/5
- [HttpGet("{id}")]
+ /*[HttpGet("{id}")]
public string Get(int id)
{
return "value";
- }
+ }*/
// POST api/<controller>/Felis
[HttpPost]
public string Post([FromBody]Command cmd)
{
- return cmd.Name + " strichelt erfolgreich das Einhorn" + cmd.CmdText;
+ try
+ {
+ return Commands.CommandHandler.ExecuteCommand(cmd);
+ }
+ catch (Exception e)
+ {
+ return $"Ein Fehler ist aufgetreten: \n {e.Message}";
+ }
+
}
+/*
// PUT api/<controller>/5
[HttpPut("{id}")]
@@ -44,6 +53,6 @@ namespace DSACore.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
- }
+ }*/
}
}