You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AuthenticationController.cs 941B

12345678910111213141516171819202122232425262728293031323334
  1. 
  2. using Microsoft.AspNetCore.Mvc;
  3. using ProRestaurant.Containers;
  4. using ProRestaurant.Repository.Accounts;
  5. namespace ProRestaurant.Controllers.Accounts
  6. {
  7. [Route("api/[controller]")]
  8. [ApiController]
  9. public class AuthenticationController : ControllerBase
  10. {
  11. private IAuthenticateRepository repo;
  12. public AuthenticationController(IAuthenticateRepository Repo)
  13. {
  14. repo = Repo;
  15. }
  16. [HttpGet]
  17. public IActionResult Get()
  18. {
  19. return new OkObjectResult(repo.GetAuthenticationContiner());
  20. }
  21. [HttpPost("authenticate")]
  22. public IActionResult Authenticate([FromBody] AuthenticationContiner User)
  23. {
  24. var user = repo.Login(User);
  25. //if (user.Result != "Access Granted")
  26. // return BadRequest(new { message = user.Result });
  27. return Ok(user);
  28. }
  29. }
  30. }