diff --git a/Bank/Bank.sln b/Bank/Bank.sln
index d64bf2a..f15c975 100644
--- a/Bank/Bank.sln
+++ b/Bank/Bank.sln
@@ -9,7 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankContracts", "BankContra
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankDatabaseImplement", "BankDatabaseImplement\BankDatabaseImplement.csproj", "{E038E32E-3601-4A3C-BB3D-301F9AE9B8E7}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankBusinessLogic", "BankBusinessLogic\BankBusinessLogic.csproj", "{0C433C84-5E7C-4CB9-9072-E9B2F479FBF3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankBusinessLogic", "BankBusinessLogic\BankBusinessLogic.csproj", "{0C433C84-5E7C-4CB9-9072-E9B2F479FBF3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankRestApi", "BankRestApi\BankRestApi.csproj", "{98FCB29C-6573-4FB9-A6DE-42C90387F1C7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -33,6 +35,10 @@ Global
{0C433C84-5E7C-4CB9-9072-E9B2F479FBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C433C84-5E7C-4CB9-9072-E9B2F479FBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C433C84-5E7C-4CB9-9072-E9B2F479FBF3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {98FCB29C-6573-4FB9-A6DE-42C90387F1C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {98FCB29C-6573-4FB9-A6DE-42C90387F1C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {98FCB29C-6573-4FB9-A6DE-42C90387F1C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {98FCB29C-6573-4FB9-A6DE-42C90387F1C7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Bank/BankRestApi/BankRestApi.csproj b/Bank/BankRestApi/BankRestApi.csproj
new file mode 100644
index 0000000..2d7c0b4
--- /dev/null
+++ b/Bank/BankRestApi/BankRestApi.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bank/BankRestApi/Controllers/MainController.cs b/Bank/BankRestApi/Controllers/MainController.cs
new file mode 100644
index 0000000..63cb8f1
--- /dev/null
+++ b/Bank/BankRestApi/Controllers/MainController.cs
@@ -0,0 +1,250 @@
+using BankContracts.BindingModels;
+using BankContracts.BusinessLogicsContracts;
+using BankContracts.SearchModels;
+using BankContracts.ViewModels;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore.ChangeTracking;
+using System.Diagnostics.Contracts;
+
+namespace BankRestApi.Controllers
+{
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class MainController : Controller
+ {
+ private readonly ILogger _logger;
+ private readonly IClientLogic _client;
+ private readonly ICardLogic _card;
+ private readonly IOperationLogic _operation;
+ private readonly IRequestLogic _request;
+
+ public MainController(ILogger logger, IClientLogic client, ICardLogic card, IOperationLogic operation, IRequestLogic request)
+ {
+ _logger = logger;
+ _client = client;
+ _card = card;
+ _operation = operation;
+ _request = request;
+ }
+
+ [HttpGet]
+ public List? GetClientList()
+ {
+ try
+ {
+ return _client.ReadList(null);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения списка клиентов");
+ throw;
+ }
+ }
+ [HttpGet]
+ public ClientViewModel? GetClient(int ClientId)
+ {
+ try
+ {
+ return _client.ReadElement(new ClientSearchModel
+ {
+ Id = ClientId
+ });
+ }catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения клиента по Id={Id}", ClientId);
+ throw;
+ }
+ }
+ [HttpGet]
+ public List? GetCardList()
+ {
+ try
+ {
+ return _card.ReadList(null);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения списка карт");
+ throw;
+ }
+ }
+ [HttpGet]
+ public CardViewModel? GetCard(int CardId)
+ {
+ try
+ {
+ return _card.ReadElement(new CardSearchModel
+ {
+ Id = CardId
+ });
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения карты по Id={Id}", CardId);
+ throw;
+ }
+ }
+ [HttpGet]
+ public List? getOperationList()
+ {
+ try
+ {
+ return _operation.ReadList(null);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения списка операций");
+ throw;
+ }
+ }
+ [HttpGet]
+ public OperationViewModel? GetOperation(int OperationId)
+ {
+ try
+ {
+ return _operation.ReadElement(new OperationSearchModel
+ {
+ Id = OperationId
+ });
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения операции по Id={Id}", OperationId);
+ throw;
+ }
+ }
+ [HttpGet]
+ public List? GetRequestList()
+ {
+ try
+ {
+ return _request.ReadList(null);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения списка запросов");
+ throw;
+ }
+ }
+ [HttpGet]
+ public RequestViewModel? GetRequest(int RequestId)
+ {
+ try
+ {
+ return _request.ReadElement(new RequestSearchModel
+ {
+ Id = RequestId
+ });
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения запроса по Id={Id}", RequestId);
+ throw;
+ }
+ }
+ [HttpPost]
+ public void CreateClient(ClientBindingModel model)
+ {
+ try
+ {
+ _client.Create(model);
+ }
+ catch(Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания клиента");
+ throw;
+ }
+ }
+ [HttpPost]
+ public void CreateCard(CardBindingModel model)
+ {
+ try
+ {
+ _card.Create(model);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания карты");
+ throw;
+ }
+ }
+ [HttpPost]
+ public void CreateOperation(OperationBindingModel model)
+ {
+ try
+ {
+ _operation.Create(model);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания операции");
+ throw;
+ }
+ }
+ [HttpPost]
+ public void CreateRequest(RequestBindingModel model)
+ {
+ try
+ {
+ _request.Create(model);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания запроса");
+ throw;
+ }
+ }
+ [HttpPut]
+ public void UpdateClient(ClientBindingModel model)
+ {
+ try
+ {
+ _client.Update(model);
+ }
+ catch(Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка обновления клиента");
+ throw;
+ }
+ }
+ [HttpPut]
+ public void UpdateCard(CardBindingModel model)
+ {
+ try
+ {
+ _card.Update(model);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка обновления карты");
+ throw;
+ }
+ }
+ [HttpPut]
+ public void UpdateOperation(OperationBindingModel model)
+ {
+ try
+ {
+ _operation.Update(model);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка обновления операции");
+ throw;
+ }
+ }
+ [HttpPut]
+ public void UpdateRequest(RequestBindingModel model)
+ {
+ try
+ {
+ _request.Update(model);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка обновления запроса");
+ throw;
+ }
+ }
+ }
+}
diff --git a/Bank/BankRestApi/Program.cs b/Bank/BankRestApi/Program.cs
new file mode 100644
index 0000000..d7a851e
--- /dev/null
+++ b/Bank/BankRestApi/Program.cs
@@ -0,0 +1,25 @@
+var builder = WebApplication.CreateBuilder(args);
+
+// Add services to the container.
+
+builder.Services.AddControllers();
+// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
+builder.Services.AddEndpointsApiExplorer();
+builder.Services.AddSwaggerGen();
+
+var app = builder.Build();
+
+// Configure the HTTP request pipeline.
+if (app.Environment.IsDevelopment())
+{
+ app.UseSwagger();
+ app.UseSwaggerUI();
+}
+
+app.UseHttpsRedirection();
+
+app.UseAuthorization();
+
+app.MapControllers();
+
+app.Run();
diff --git a/Bank/BankRestApi/Properties/launchSettings.json b/Bank/BankRestApi/Properties/launchSettings.json
new file mode 100644
index 0000000..aadfc76
--- /dev/null
+++ b/Bank/BankRestApi/Properties/launchSettings.json
@@ -0,0 +1,31 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:27552",
+ "sslPort": 44383
+ }
+ },
+ "profiles": {
+ "BankRestApi": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "https://localhost:7177;http://localhost:5116",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/Bank/BankRestApi/appsettings.Development.json b/Bank/BankRestApi/appsettings.Development.json
new file mode 100644
index 0000000..0c208ae
--- /dev/null
+++ b/Bank/BankRestApi/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/Bank/BankRestApi/appsettings.json b/Bank/BankRestApi/appsettings.json
new file mode 100644
index 0000000..10f68b8
--- /dev/null
+++ b/Bank/BankRestApi/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}