aboutsummaryrefslogtreecommitdiff
path: root/API/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'API/Controllers')
-rw-r--r--API/Controllers/RoleController.cs36
-rw-r--r--API/Controllers/UserController.cs2
2 files changed, 37 insertions, 1 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);
+ }
+ }
+}
diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs
index 8503922..5817d47 100644
--- a/API/Controllers/UserController.cs
+++ b/API/Controllers/UserController.cs
@@ -3,7 +3,7 @@ using API.Database;
using API.Service;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
-using Data.Models.DTOs;
+using Data.Models.DTOs.Identity;
using Microsoft.AspNetCore.Authorization;
using Data.Models.Options;