using Microsoft.AspNetCore.Mvc; using ProRestaurant.Containers; using ProRestaurant.Repository.Accounts; namespace ProRestaurant.Controllers.Accounts { [Route("api/[controller]")] [ApiController] public class AuthenticationController : ControllerBase { private IAuthenticateRepository repo; public AuthenticationController(IAuthenticateRepository Repo) { repo = Repo; } [HttpGet] public IActionResult Get() { return new OkObjectResult(repo.GetAuthenticationContiner()); } [HttpPost("authenticate")] public IActionResult Authenticate([FromBody] AuthenticationContiner User) { var user = repo.Login(User); if (user.Result != "Access Granted") return BadRequest(new { message = user.Result }); return Ok(user); } } }