diff options
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(); + } + } +} |