From b7e7f0d9096190869342534324cdf0e2854c1782 Mon Sep 17 00:00:00 2001 From: shadowik Date: Sun, 14 May 2023 15:47:08 +0400 Subject: [PATCH] . --- .../BankYouBancruptDatabase.cs | 2 +- .../Controllers/CardController.cs | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBancruptDatabase.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBancruptDatabase.cs index 803600d..15c14f8 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBancruptDatabase.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBancruptDatabase.cs @@ -16,7 +16,7 @@ namespace BankYouBankruptDatabaseImplement if (!optionsBuilder.IsConfigured) { //optionsBuilder.UseSqlServer(@"Data Source=SHADOWIK\SHADOWIK;Initial Catalog=BankYouBankrupt;Integrated Security=True;TrustServerCertificate=True"); - optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-CFLH20EE\SQLEXPRESS;Initial Catalog=BankYouBankrupt;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-CFLH20EE\SQLEXPRESS;Initial Catalog=BankYouBankrupt;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs index 418db10..d04def1 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/CardController.cs @@ -18,11 +18,14 @@ namespace BankYouBankruptRestApi.Controllers private readonly IDebitingLogic _debitingLogic; - public CardController(ICardLogic cardLogic, IDebitingLogic debitingLogic, ILogger logger) + private readonly ICreditingLogic _creditingLogic; + + public CardController(ICardLogic cardLogic, IDebitingLogic debitingLogic, ICreditingLogic creditingLogic, ILogger logger) { _logger = logger; _cardLogic = cardLogic; _debitingLogic = debitingLogic; + _creditingLogic = creditingLogic; } [HttpGet] @@ -61,9 +64,20 @@ namespace BankYouBankruptRestApi.Controllers } catch (Exception ex) { - _logger.LogError(ex, "Ошибка создания на снятие наличных"); + _logger.LogError(ex, "Ошибка создания запроса на снятие наличных"); Response.StatusCode = (int)HttpStatusCode.NotAcceptable; } - } + } + + [HttpPost] + public void CreateCreditingOperation(CreditingBindingModel model) { + try { + _creditingLogic.Create(model); + } + catch (Exception ex) { + _logger.LogError(ex, "Ошибка создания операции на пополнение"); + Response.StatusCode = (int)HttpStatusCode.NotAcceptable; + } + } } }