summaryrefslogtreecommitdiff
path: root/Controllers
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2022-11-06 02:10:44 -0600
committerHombreLaser <sebastian-440@live.com>2022-11-06 02:10:44 -0600
commit08819c6738a4f82ccf07ae5ed60835b087f7bb34 (patch)
tree9c0c77626587136d41002769fb5a030e1be2f5b8 /Controllers
parentf060c4f88f635af3295ea7652cbbbd08dbf1c6cf (diff)
Añadidos grupos y usuarios
Diffstat (limited to 'Controllers')
-rw-r--r--Controllers/GroupsController.cs24
-rw-r--r--Controllers/UserAccountsController.cs24
2 files changed, 48 insertions, 0 deletions
diff --git a/Controllers/GroupsController.cs b/Controllers/GroupsController.cs
new file mode 100644
index 0000000..f81cc56
--- /dev/null
+++ b/Controllers/GroupsController.cs
@@ -0,0 +1,24 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using LibraryAPI.Models;
+using LibraryAPI.Filters;
+
+namespace LibraryAPI.Controllers {
+ [Route("api/groups")]
+ [ApiController]
+ public class GroupsController : ControllerBase {
+ private readonly LibraryContext _context;
+
+ public GroupsController(LibraryContext context) {
+ _context = context;
+ }
+
+ [HttpPost]
+ public async Task<ActionResult> PostGroup(Group g) {
+ _context.Add(g);
+ await _context.SaveChangesAsync();
+
+ return Ok();
+ }
+ }
+}
diff --git a/Controllers/UserAccountsController.cs b/Controllers/UserAccountsController.cs
new file mode 100644
index 0000000..d93ad31
--- /dev/null
+++ b/Controllers/UserAccountsController.cs
@@ -0,0 +1,24 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using LibraryAPI.Models;
+using LibraryAPI.Filters;
+
+namespace LibraryAPI.Controllers {
+ [Route("api/users")]
+ [ApiController]
+ public class UserAccountsController : ControllerBase {
+ private readonly LibraryContext _context;
+
+ public UserAccountsController(LibraryContext context) {
+ _context = context;
+ }
+
+ [HttpPost("signup")]
+ public async Task<ActionResult> PostUserAccount(UserAccount user) {
+ _context.Add(user);
+ await _context.SaveChangesAsync();
+
+ return Ok();
+ }
+ }
+}