From 2533ba90c0a0496d80fd70a2cdde24adcdac783d Mon Sep 17 00:00:00 2001 From: mfnefd Date: Thu, 6 Jun 2024 17:52:35 +0400 Subject: [PATCH] fix user controller (login) --- RestAPI/Controllers/UserController.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/RestAPI/Controllers/UserController.cs b/RestAPI/Controllers/UserController.cs index f985b4d..bbeb162 100644 --- a/RestAPI/Controllers/UserController.cs +++ b/RestAPI/Controllers/UserController.cs @@ -21,11 +21,11 @@ namespace RestAPI.Controllers } [HttpPost] - public IResult Login([FromBody] UserBindingModel model) + public IResult Login(string email, string password) { try { - var res = _userLogic.Login(model); + var res = _userLogic.Login(email, password); return Results.Ok(res); } catch (ElementNotFoundException ex) @@ -50,17 +50,19 @@ namespace RestAPI.Controllers { try { - var res = _userLogic.Login(model); + var res = _userLogic.Create(model); return Results.Ok(res); } catch (AccountException ex) { _logger.LogWarning(ex, "Wrong registration data"); + throw; return Results.BadRequest(ex.Message); } catch (Exception ex) { _logger.LogError(ex, "Error create user"); + throw; return Results.Problem(ex.Message); } }