RestApi ClientController
This commit is contained in:
parent
6581e26f7f
commit
0b7edbd7a0
@ -4,6 +4,8 @@
|
||||
{
|
||||
public string? MessageId { get; set; }
|
||||
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
public string? SenderName { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user