From 4e4ad8b4ba9938cc3f32bce3c606d73560267604 Mon Sep 17 00:00:00 2001 From: transtrike Date: Thu, 10 Dec 2020 11:28:23 +0200 Subject: Testig API with HTTP Post in User --- API/Controllers/UserController.cs | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 API/Controllers/UserController.cs (limited to 'API/Controllers') diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs new file mode 100644 index 0000000..d9b55db --- /dev/null +++ b/API/Controllers/UserController.cs @@ -0,0 +1,41 @@ +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using API.Database; +using API.Service; +using Microsoft.AspNetCore.Mvc; +using Models.Classes; +using Models.DTOs; + +namespace API.Controllers +{ + [ApiController] + [Route("/api/[controller]")] + public class UserController: ControllerBase + { + private readonly UserService _service; + + public UserController(DevHiveContext context) + { + this._service = new UserService(context); + } + + //Create + [HttpPost] + public async Task Create([FromForm] UserDTO userDTO) + { + HttpStatusCode returnStatusCode = await this._service.CreateUser(userDTO); + + return returnStatusCode; + } + + //Read + // [HttpGet] + + // //Update + // [HttpPut] + + // //Delete + // [HttpDelete] + } +} \ No newline at end of file -- cgit v1.2.3