summaryrefslogtreecommitdiff
path: root/DSACore/Controllers
diff options
context:
space:
mode:
authoruzvkl <dennis.kobert@student.kit.edu>2019-06-11 23:05:52 +0200
committeruzvkl <dennis.kobert@student.kit.edu>2019-06-11 23:05:52 +0200
commite6181c24124d97f2fbc932b8a68311e625463156 (patch)
treec1f097c344ca266b7941c9668590b0fd35c7870a /DSACore/Controllers
parent2490ad5d31fe2ac778ff9303776f0e91f47a2862 (diff)
Move dsa related stuff to subfolder
Diffstat (limited to 'DSACore/Controllers')
-rw-r--r--DSACore/Controllers/CommandsController.cs56
-rw-r--r--DSACore/Controllers/LobbyController.cs32
-rw-r--r--DSACore/Controllers/TokensController.cs25
-rw-r--r--DSACore/Controllers/ValuesController.cs45
4 files changed, 0 insertions, 158 deletions
diff --git a/DSACore/Controllers/CommandsController.cs b/DSACore/Controllers/CommandsController.cs
deleted file mode 100644
index b6e0be2..0000000
--- a/DSACore/Controllers/CommandsController.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using DSACore.Models.Network;
-using DSALib.Commands;
-using DSALib.Models.Network;
-using Microsoft.AspNetCore.Mvc;
-
-// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
-
-namespace DSACore.Controllers
-{
- [Route("dsa/[controller]")]
- public class CommandsController : Controller
- {
- // GET: api/<controller>
- [HttpGet]
- public string Get()
- {
- return "Usage: post the command to execute";
- }
-
- // GET api/<controller>/5
- /*[HttpGet("{id}")]
- public string Get(int id)
- {
- return "value";
- }*/
-
- // POST api/<controller>/Felis
- [HttpPost]
- public string Post([FromBody] Command cmd)
- {
- try
- {
- return CommandHandler.ExecuteCommand(cmd).message;
- }
- catch (Exception e)
- {
- return $"Ein Fehler ist aufgetreten: \n {e.Message}";
- }
- }
-
-/*
-
- // PUT api/<controller>/5
- [HttpPut("{id}")]
- public void Put(int id, [FromBody]string value)
- {
- }
-
- // DELETE api/<controller>/5
- [HttpDelete("{id}")]
- public void Delete(int id)
- {
- }*/
- }
-} \ No newline at end of file
diff --git a/DSACore/Controllers/LobbyController.cs b/DSACore/Controllers/LobbyController.cs
deleted file mode 100644
index 7890b4f..0000000
--- a/DSACore/Controllers/LobbyController.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using DSACore.Models.Network;
-using DSALib.Commands;
-using DSALib.Models.Network;
-using Microsoft.AspNetCore.Mvc;
-
-namespace DSACore.Controllers
-{
- public class ScribbleController : Controller
- {
- [Route("[controller]")]
- // GET: api/<controller>
- [HttpGet]
- public string Get()
- {
- return "Usage: get /tokens/{Token}";
- }
-
- [HttpPost]
- public string Post([FromBody] Command cmd)
- {
- try
- {
- return CommandHandler.ExecuteCommand(cmd).message;
- }
- catch (Exception e)
- {
- return $"Ein Fehler ist aufgetreten: \n {e.Message}";
- }
- }
- }
-} \ No newline at end of file
diff --git a/DSACore/Controllers/TokensController.cs b/DSACore/Controllers/TokensController.cs
deleted file mode 100644
index a85cabe..0000000
--- a/DSACore/Controllers/TokensController.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using DSACore.Hubs;
-using Microsoft.AspNetCore.Mvc;
-
-namespace DSACore.Controllers
-{
- [Route("lobby/[controller]")]
- [ApiController]
- public class TokensController : Controller
- {
- // GET
- [HttpGet("{token}")]
- public ActionResult<string> Get(string token)
- {
- if (!int.TryParse(token, out var intToken))
- return BadRequest("The token has to be a 32 bit unsigned integer");
-
- if (intToken == 42) return Ok("Scribble");
-
- if (!Users.Tokens.Exists(x => x.GetHashCode() == intToken)) return NotFound();
-
- var group = Users.Tokens.Find(x => x.GetHashCode() == intToken);
- return Ok(group.Group);
- }
- }
-} \ No newline at end of file
diff --git a/DSACore/Controllers/ValuesController.cs b/DSACore/Controllers/ValuesController.cs
deleted file mode 100644
index eb08898..0000000
--- a/DSACore/Controllers/ValuesController.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-
-namespace DSACore.Controllers
-{
- [Route("api/[controller]")]
- [ApiController]
- public class ValuesController : ControllerBase
- {
- // GET api/values
- [HttpGet]
- public ActionResult<IEnumerable<string>> Get()
- {
- return new string[] { "value1", "value2" };
- }
-
- // GET api/values/5
- [HttpGet("{id}")]
- public ActionResult<string> Get(int id)
- {
- return "value";
- }
-
- // POST api/values
- [HttpPost]
- public void Post([FromBody] string value)
- {
- }
-
- // PUT api/values/5
- [HttpPut("{id}")]
- public void Put(int id, [FromBody] string value)
- {
- }
-
- // DELETE api/values/5
- [HttpDelete("{id}")]
- public void Delete(int id)
- {
- }
- }
-}