File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,19 @@ public LoginController(LoginService loginService)
1717 _loginService = loginService ;
1818 }
1919
20+ [ HttpGet ( "ListUsers" ) ]
21+ public IActionResult ListUsers ( )
22+ {
23+ try
24+ {
25+ var listUsers = _loginService . ListUsers ( ) ;
26+ return Ok ( listUsers ) ;
27+ }
28+ catch ( Exception ex )
29+ {
30+ return BadRequest ( "Não foi possível listar os usuários." ) ;
31+ }
32+ }
2033 [ HttpPost ( "CreateAccount" ) ]
2134 public IActionResult CreateAccount ( [ FromBody ] UserEntity model )
2235 {
Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ public LoginService(AppDbContext context)
1919 {
2020 _context = context ;
2121 }
22- [ HttpGet ]
22+
23+ public IActionResult ListUsers ( )
24+ {
25+ var users = _context . Users . ToList ( ) ;
26+ return Ok ( users ) ;
27+ }
28+
2329 public IActionResult CreateAccount ( [ FromBody ] UserEntity model )
2430 {
2531 if ( model != null )
You can’t perform that action at this time.
0 commit comments