diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-06 02:10:44 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-06 02:10:44 -0600 |
commit | 08819c6738a4f82ccf07ae5ed60835b087f7bb34 (patch) | |
tree | 9c0c77626587136d41002769fb5a030e1be2f5b8 /Controllers | |
parent | f060c4f88f635af3295ea7652cbbbd08dbf1c6cf (diff) |
Añadidos grupos y usuarios
Diffstat (limited to 'Controllers')
-rw-r--r-- | Controllers/GroupsController.cs | 24 | ||||
-rw-r--r-- | Controllers/UserAccountsController.cs | 24 |
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(); + } + } +} |