From 5eff29088f85f3abb529365adf14be6efc94d57d Mon Sep 17 00:00:00 2001 From: VictoriaPresnyakova Date: Sun, 30 Apr 2023 18:17:33 +0400 Subject: [PATCH] ClientController edited --- .../Controllers/ClientController.cs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/JewelryStoreRestApi/Controllers/ClientController.cs b/JewelryStoreRestApi/Controllers/ClientController.cs index a13f57d..83011d9 100644 --- a/JewelryStoreRestApi/Controllers/ClientController.cs +++ b/JewelryStoreRestApi/Controllers/ClientController.cs @@ -11,13 +11,18 @@ namespace JewelryStoreRestApi.Controllers public class ClientController : Controller { private readonly ILogger _logger; + private readonly IClientLogic _logic; - public ClientController(IClientLogic logic, ILogger - logger) + + private readonly IMessageInfoLogic _mailLogic; + + public ClientController(IClientLogic logic, IMessageInfoLogic mailLogic, ILogger logger) { _logger = logger; _logic = logic; + _mailLogic = mailLogic; } + [HttpGet] public ClientViewModel? Login(string login, string password) { @@ -35,6 +40,7 @@ namespace JewelryStoreRestApi.Controllers throw; } } + [HttpPost] public void Register(ClientBindingModel model) { @@ -48,6 +54,7 @@ namespace JewelryStoreRestApi.Controllers throw; } } + [HttpPost] public void UpdateData(ClientBindingModel model) { @@ -61,5 +68,22 @@ namespace JewelryStoreRestApi.Controllers throw; } } + + [HttpGet] + public List? GetMessages(int clientId) + { + try + { + return _mailLogic.ReadList(new MessageInfoSearchModel + { + ClientId = clientId + }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения писем клиента"); + throw; + } + } } }