добавлен метод для получения всех писем клиента в контроллере клиента в рест апи

This commit is contained in:
Елена Бакальская 2024-05-05 17:17:34 +04:00
parent d596f13d2c
commit 1c676ba332

View File

@ -12,11 +12,12 @@ namespace SushiBarRestApi.Controllers
{
private readonly ILogger _logger;
private readonly IClientLogic _logic;
public ClientController(IClientLogic logic, ILogger<ClientController>
logger)
private readonly IMessageInfoLogic messageLogic;
public ClientController(IClientLogic logic, ILogger<ClientController> logger, IMessageInfoLogic messageLogic)
{
_logger = logger;
_logic = logic;
this.messageLogic = messageLogic;
}
[HttpGet]
public ClientViewModel? Login(string login, string password)
@ -61,5 +62,22 @@ namespace SushiBarRestApi.Controllers
throw;
}
}
public List<MessageInfoViewModel>? GetMessages(int clientId)
{
try
{
return messageLogic.ReadList(new MessageInfoSearchModel
{
ClientId = clientId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения писем клиента");
throw;
}
}
}
}