ClientController edited
This commit is contained in:
parent
d038e94079
commit
5eff29088f
@ -11,13 +11,18 @@ namespace JewelryStoreRestApi.Controllers
|
|||||||
public class ClientController : Controller
|
public class ClientController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IClientLogic _logic;
|
private readonly IClientLogic _logic;
|
||||||
public ClientController(IClientLogic logic, ILogger<ClientController>
|
|
||||||
logger)
|
private readonly IMessageInfoLogic _mailLogic;
|
||||||
|
|
||||||
|
public ClientController(IClientLogic logic, IMessageInfoLogic mailLogic, ILogger<ClientController> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
|
_mailLogic = mailLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ClientViewModel? Login(string login, string password)
|
public ClientViewModel? Login(string login, string password)
|
||||||
{
|
{
|
||||||
@ -35,6 +40,7 @@ namespace JewelryStoreRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Register(ClientBindingModel model)
|
public void Register(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
@ -48,6 +54,7 @@ namespace JewelryStoreRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void UpdateData(ClientBindingModel model)
|
public void UpdateData(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
@ -61,5 +68,22 @@ namespace JewelryStoreRestApi.Controllers
|
|||||||
throw;
|
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