Начал заполнять restapi и implementerApp. ДО МИГРАЦИИ
This commit is contained in:
parent
59ddcc2041
commit
cb2210f479
@ -7,7 +7,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComputerShopContracts\ComputerShopContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
9
ComputerShopImplementerApp/Models/ErrorViewModel.cs
Normal file
9
ComputerShopImplementerApp/Models/ErrorViewModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace ComputerShopImplementerApp.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
@ -5,5 +5,6 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"IpAddress": "http://localhost:5055"
|
||||
}
|
||||
|
@ -10,4 +10,10 @@
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComputerShopBusinessLogic\ComputerShopBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\ComputerShopContracts\ComputerShopContracts.csproj" />
|
||||
<ProjectReference Include="..\ComputerShopDatabaseImplement\ComputerShopDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
40
ComputerShopRestApi/Controllers/UserController.cs
Normal file
40
ComputerShopRestApi/Controllers/UserController.cs
Normal file
@ -0,0 +1,40 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user