RestApi ClientController

This commit is contained in:
ShabOl 2024-04-19 21:34:16 +04:00
parent 6581e26f7f
commit 0b7edbd7a0
2 changed files with 22 additions and 1 deletions

View File

@ -4,6 +4,8 @@
{
public string? MessageId { get; set; }
public int? ClientId { get; set; }
public string? SenderName { get; set; }
}
}

View File

@ -12,11 +12,13 @@ namespace AutoWorkshopRestApi.Controllers
{
private readonly ILogger _logger;
private readonly IClientLogic _clientLogic;
private readonly IMessageInfoLogic _mailLogic;
public ClientController(IClientLogic ClientLogic, ILogger<ClientController> Logger)
public ClientController(IClientLogic ClientLogic, IMessageInfoLogic MailLogic, ILogger<ClientController> Logger)
{
_logger = Logger;
_clientLogic = ClientLogic;
_mailLogic = MailLogic;
}
[HttpGet]
@ -64,5 +66,22 @@ namespace AutoWorkshopRestApi.Controllers
throw;
}
}
[HttpGet]
public List<MessageInfoViewModel>? GetMessages(int ClientId)
{
try
{
return _mailLogic.ReadList(new MessageInfoSearchModel
{
ClientId = ClientId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения писем клиента");
throw;
}
}
}
}