aboutsummaryrefslogtreecommitdiff
path: root/API/Controllers/RoleController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'API/Controllers/RoleController.cs')
-rw-r--r--API/Controllers/RoleController.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/API/Controllers/RoleController.cs b/API/Controllers/RoleController.cs
new file mode 100644
index 0000000..20179f4
--- /dev/null
+++ b/API/Controllers/RoleController.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using API.Database;
+using API.Service;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+
+namespace API.Controllers
+{
+ [ApiController]
+ [Route("/api/[controller]")]
+ public class RoleController
+ {
+ private readonly RoleService _service;
+
+ public RoleController(DevHiveContext context)
+ {
+ this._service = new RoleService(context);
+ }
+
+ [HttpPost]
+ public Task<IActionResult> Create(string name)
+ {
+ return this._service.CreatePost(name);
+ }
+
+ [HttpGet]
+ public Task<IActionResult> ShowPost(uint postId)
+ {
+ return this._service.GetPostById(postId);
+ }
+ }
+}