From cd4785347eb641a0fab1a7157d701dd5d8c3259f Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Thu, 27 Sep 2018 00:31:30 +0200 Subject: hoked the command handler up to the web api modified file locations --- DSACore/Controllers/CommandsController.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'DSACore/Controllers/CommandsController.cs') 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/ [HttpGet] - public IEnumerable Get() + public string Get() { - return new string[] { "value1", "value2" }; + return "Dies ist die supa dolle Web Api"; } // GET api//5 - [HttpGet("{id}")] + /*[HttpGet("{id}")] public string Get(int id) { return "value"; - } + }*/ // POST api//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//5 [HttpPut("{id}")] @@ -44,6 +53,6 @@ namespace DSACore.Controllers [HttpDelete("{id}")] public void Delete(int id) { - } + }*/ } } -- cgit v1.2.3-70-g09d2