41 lines
862 B
C#
41 lines
862 B
C#
using ComputerShopContracts.BusinessLogicContracts;
|
|
using ComputerShopContracts.SearchModels;
|
|
using ComputerShopContracts.ViewModels;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ComputerShopRestApi.Controllers
|
|
{
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class UserController : Controller
|
|
{
|
|
private readonly ILogger _logger;
|
|
private readonly IUserLogic _logic;
|
|
|
|
public UserController(IUserLogic logic, ILogger<UserController> logger)
|
|
{
|
|
_logic = logic;
|
|
_logger = logger;
|
|
}
|
|
|
|
[HttpGet]
|
|
public UserViewModel? Login(string login, string password)
|
|
{
|
|
try
|
|
{
|
|
return _logic.ReadElement(new UserSearchModel
|
|
{
|
|
Login = login,
|
|
Email = login,
|
|
//Password = password
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Ошибка входа в систему");
|
|
throw;
|
|
}
|
|
}
|
|
}
|
|
}
|