finish Withdrawals (but without some things)
This commit is contained in:
parent
6358f6481b
commit
3bda3fd5de
@ -36,6 +36,18 @@ namespace BankBusinessLogic.BusinessLogic
|
||||
_logger.LogInformation("ReadList Count: {Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public List<int> ReadAccountIdsByWithdrawal(AccountSearchModel model)
|
||||
{
|
||||
_logger.LogInformation("ReadAccountIdsByWithdrawal. Number: {Number}, Id: {Id}", model?.Number, model?.Id);
|
||||
if (model == null)
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
var list = _accountStorage.GetAccountIdsByWithdrawal(model);
|
||||
if (list == null)
|
||||
return new();
|
||||
_logger.LogInformation("ReadListByRequestId Count: {Count}", list.Count);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public AccountViewModel? ReadElement(AccountSearchModel model)
|
||||
{
|
||||
|
@ -72,9 +72,21 @@ namespace BankBusinessLogic.BusinessLogic
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Delete(WithdrawalBindingModel model)
|
||||
public bool LinkToRequest(int withdrawalId, int requestId)
|
||||
{
|
||||
if (withdrawalId <= 0 || requestId <= 0)
|
||||
return false;
|
||||
if (_withdrawalStorage.LinkToRequest(withdrawalId, requestId) == null)
|
||||
{
|
||||
_logger.LogWarning("link operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(WithdrawalBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (_withdrawalStorage.Delete(model) == null)
|
||||
|
@ -12,6 +12,7 @@ namespace BankContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public DateTime WithdrawalTime { get; set; } = DateTime.Now;
|
||||
public int? RequestId { get; set; }
|
||||
public int Sum { get; set; }
|
||||
public Dictionary<int, (IAccountModel, int)> WithdrawalAccounts { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace BankContracts.BusinessLogicsContracts
|
||||
public interface IAccountLogic
|
||||
{
|
||||
List<AccountViewModel>? ReadList(AccountSearchModel? model);
|
||||
List<int> ReadAccountIdsByWithdrawal(AccountSearchModel model);
|
||||
AccountViewModel? ReadElement(AccountSearchModel model);
|
||||
bool Create(AccountBindingModel model);
|
||||
bool Update(AccountBindingModel model);
|
||||
|
@ -15,6 +15,7 @@ namespace BankContracts.BusinessLogicsContracts
|
||||
WithdrawalViewModel? ReadElement(WithdrawalSearchModel model);
|
||||
bool Create(WithdrawalBindingModel model);
|
||||
bool Update(WithdrawalBindingModel model);
|
||||
bool LinkToRequest(int withdrawalId, int requestId);
|
||||
bool Delete(WithdrawalBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace BankContracts.SearchModels
|
||||
public DateTime? DateTo { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public int? ManagerId { get; set; }
|
||||
public int? WithdrawalId { get; set; }
|
||||
public List<int>? SelectedAccountIds { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ namespace BankContracts.SearchModels
|
||||
public DateTime? DateTo { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public int? RequestId { get; set; }
|
||||
public int? ManagerId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ namespace BankContracts.StoragesContracts
|
||||
{
|
||||
List<AccountViewModel> GetFullList();
|
||||
List<AccountViewModel> GetFilteredList(AccountSearchModel model);
|
||||
List<ReportRequestsViewModel> GetRequestsReport(AccountSearchModel model);
|
||||
List<int> GetAccountIdsByWithdrawal(AccountSearchModel model);
|
||||
List<ReportRequestsViewModel> GetRequestsReport(AccountSearchModel model);
|
||||
List<ReportTransfersWithdrawalsViewModel> GetTransfersWithdrawalsReport(AccountSearchModel model);
|
||||
AccountViewModel? GetElement(AccountSearchModel model);
|
||||
AccountViewModel? Insert(AccountBindingModel model);
|
||||
|
@ -16,6 +16,7 @@ namespace BankContracts.StoragesContracts
|
||||
WithdrawalViewModel? GetElement(WithdrawalSearchModel model);
|
||||
WithdrawalViewModel? Insert(WithdrawalBindingModel model);
|
||||
WithdrawalViewModel? Update(WithdrawalBindingModel model);
|
||||
WithdrawalViewModel? Delete(WithdrawalBindingModel model);
|
||||
WithdrawalViewModel? LinkToRequest(int withdrawalId, int requestId);
|
||||
WithdrawalViewModel? Delete(WithdrawalBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace BankContracts.ViewModels
|
||||
[DisplayName("Номер заявки")]
|
||||
public int? RequestId { get; set; }
|
||||
[DisplayName("Сумма")]
|
||||
public int? Sum { get; set; }
|
||||
public int Sum { get; set; }
|
||||
public Dictionary<int, (IAccountModel, int)> WithdrawalAccounts { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace BankDataModels.Models
|
||||
{
|
||||
DateTime WithdrawalTime { get; set; }
|
||||
int? RequestId { get; set; }
|
||||
int Sum { get; }
|
||||
Dictionary<int, (IAccountModel, int)> WithdrawalAccounts { get; }
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ namespace BankDatabaseImplement.Implements
|
||||
.Include(x => x.AccountWithdrawals)
|
||||
.Include(x => x.SenderTransfers)
|
||||
.Include(x => x.RecipientTransfers)
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<AccountViewModel> GetFilteredList(AccountSearchModel model)
|
||||
@ -36,13 +37,20 @@ namespace BankDatabaseImplement.Implements
|
||||
.Where(x =>
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(!model.ManagerId.HasValue || x.ManagerId == model.ManagerId) &&
|
||||
(string.IsNullOrEmpty(model.Number) || x.Number == model.Number)
|
||||
)
|
||||
(string.IsNullOrEmpty(model.Number) || x.Number == model.Number))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public List<int> GetAccountIdsByWithdrawal(AccountSearchModel model)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.AccountWithdrawals
|
||||
.Where(x => !model.WithdrawalId.HasValue || x.WithdrawalId == model.WithdrawalId)
|
||||
.Select(x => x.AccountId)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public AccountViewModel? GetElement(AccountSearchModel model)
|
||||
public AccountViewModel? GetElement(AccountSearchModel model)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Accounts
|
||||
|
@ -21,7 +21,6 @@ namespace BankDatabaseImplement.Implements
|
||||
.Include(x => x.Request)
|
||||
.Include(x => x.Accounts)
|
||||
.ThenInclude(x => x.Account)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -38,7 +37,6 @@ namespace BankDatabaseImplement.Implements
|
||||
(!model.RequestId.HasValue || x.RequestId == model.RequestId) &&
|
||||
(!model.DateFrom.HasValue || x.WithdrawalTime >= model.DateFrom) &&
|
||||
(!model.DateTo.HasValue || x.WithdrawalTime <= model.DateTo))
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -73,28 +71,53 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
Withdrawal? withdrawal;
|
||||
try
|
||||
{
|
||||
var Withdrawal = context.Withdrawals.FirstOrDefault(rec =>
|
||||
withdrawal = context.Withdrawals.FirstOrDefault(rec =>
|
||||
rec.Id == model.Id);
|
||||
if (Withdrawal == null)
|
||||
if (withdrawal == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Withdrawal.Update(model);
|
||||
withdrawal.Update(model);
|
||||
context.SaveChanges();
|
||||
Withdrawal.UpdateAccounts(context, model);
|
||||
withdrawal.UpdateAccounts(context, model);
|
||||
transaction.Commit();
|
||||
return Withdrawal.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return withdrawal.GetViewModel;
|
||||
}
|
||||
|
||||
public WithdrawalViewModel? Delete(WithdrawalBindingModel model)
|
||||
public WithdrawalViewModel? LinkToRequest(int withdrawalId, int requestId)
|
||||
{
|
||||
if (requestId <= 0 || withdrawalId <= 0)
|
||||
return null;
|
||||
using var context = new BankDatabase();
|
||||
var withdrawal = context.Withdrawals
|
||||
.Include(x => x.Request)
|
||||
.Include(x => x.Accounts)
|
||||
.ThenInclude(x => x.Account)
|
||||
.FirstOrDefault(x => x.Id == withdrawalId);
|
||||
if (withdrawal == null)
|
||||
return null;
|
||||
var newWithdrawal = new WithdrawalBindingModel
|
||||
{
|
||||
Sum = withdrawal.Sum,
|
||||
WithdrawalTime = withdrawal.WithdrawalTime,
|
||||
WithdrawalAccounts = withdrawal.WithdrawalAccounts,
|
||||
RequestId = requestId
|
||||
};
|
||||
withdrawal.Update(newWithdrawal);
|
||||
context.SaveChanges();
|
||||
return withdrawal.GetViewModel;
|
||||
}
|
||||
|
||||
public WithdrawalViewModel? Delete(WithdrawalBindingModel model)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
var element = context.Withdrawals
|
||||
|
@ -36,7 +36,19 @@ namespace BankDatabaseImplement.Models
|
||||
return _withdrawalAccounts;
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int Sum
|
||||
{
|
||||
get
|
||||
{
|
||||
int sum = 0;
|
||||
foreach (var account in Accounts)
|
||||
{
|
||||
sum += account.Sum;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
public static Withdrawal Create(BankDatabase context, WithdrawalBindingModel model)
|
||||
{
|
||||
return new Withdrawal
|
||||
@ -62,7 +74,7 @@ namespace BankDatabaseImplement.Models
|
||||
WithdrawalTime = WithdrawalTime,
|
||||
WithdrawalAccounts = WithdrawalAccounts,
|
||||
RequestId = RequestId,
|
||||
Sum = Request?.Sum,
|
||||
Sum = Sum,
|
||||
};
|
||||
|
||||
public void UpdateAccounts(BankDatabase context, WithdrawalBindingModel model)
|
||||
@ -72,7 +84,12 @@ namespace BankDatabaseImplement.Models
|
||||
{
|
||||
context.AccountWithdrawals.RemoveRange(WithdrawalAccounts.Where(rec => !model.WithdrawalAccounts.ContainsKey(rec.AccountId)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
foreach (var wa in WithdrawalAccounts)
|
||||
{
|
||||
model.WithdrawalAccounts.Remove(wa.AccountId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var Withdrawal = context.Withdrawals.First(x => x.Id == Id);
|
||||
foreach (var account in model.WithdrawalAccounts)
|
||||
{
|
||||
|
@ -1,5 +1,8 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankDatabaseImplement.Models;
|
||||
using BankDataModels.Models;
|
||||
using BankManagersClientApp.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
@ -317,57 +320,135 @@ namespace BankManagersClientApp.Controllers
|
||||
});
|
||||
Response.Redirect("Transfers");
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region//работа с выдачами
|
||||
public IActionResult Withdrawals()
|
||||
#region//Withdrawals
|
||||
[HttpGet]
|
||||
public IActionResult Withdrawals()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<WithdrawalViewModel>>($"api/withdrawal/getwithdrawallist?managerid={APIClient.Client.Id}"));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult WithdrawalCreate()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Accounts = APIClient.GetRequest<List<AccountViewModel>>($"api/account/getaccountlist?managerid={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult WithdrawalCreate()
|
||||
[HttpPost]
|
||||
public void WithdrawalCreate(int sum, List<int> accounts)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Dictionary<int, (IAccountModel, int)> accountsDictionary = new();
|
||||
foreach (int account in accounts)
|
||||
{
|
||||
accountsDictionary.Add(account, (new AccountBindingModel { Id = account }, 0));
|
||||
}
|
||||
APIClient.PostRequest("/api/withdrawal/createwithdrawal", new WithdrawalBindingModel
|
||||
{
|
||||
Sum = sum,
|
||||
WithdrawalAccounts = accountsDictionary,
|
||||
});
|
||||
Response.Redirect("Withdrawals");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult WithdrawalUpdate()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
}
|
||||
ViewBag.Withdrawals = APIClient.GetRequest<List<WithdrawalViewModel>>($"api/withdrawal/getwithdrawallist?managerid={APIClient.Client.Id}");
|
||||
ViewBag.Accounts = APIClient.GetRequest<List<AccountViewModel>>($"api/account/getaccountlist?managerid={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult WithdrawalUpdate()
|
||||
[HttpPost]
|
||||
public void WithdrawalUpdate(int withdrawal, int sum, List<int> accounts)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Dictionary<int, (IAccountModel, int)> dictionary = new();
|
||||
foreach (int account in accounts)
|
||||
{
|
||||
dictionary.Add(account, (new AccountBindingModel
|
||||
{
|
||||
Id = account,
|
||||
}, 0));
|
||||
}
|
||||
APIClient.PostRequest("/api/withdrawal/updatewithdrawal", new WithdrawalBindingModel
|
||||
{
|
||||
Id = withdrawal,
|
||||
Sum = sum,
|
||||
WithdrawalAccounts = dictionary,
|
||||
});
|
||||
Response.Redirect("Withdrawals");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<int> GetAccounts(int withdrawalId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
return APIClient.GetRequest<List<int>>($"api/account/getaccounts?withdrawalId={withdrawalId}") ?? new();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult WithdrawalDelete()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
}
|
||||
ViewBag.Withdrawals = APIClient.GetRequest<List<WithdrawalViewModel>>($"api/withdrawal/getwithdrawallist?managerid={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult WithdrawalDelete()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void WithdrawalDelete(int withdrawal)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIClient.PostRequest("api/withdrawal/deletewithdrawal", new WithdrawalBindingModel
|
||||
{
|
||||
Id = withdrawal,
|
||||
});
|
||||
Response.Redirect("Withdrawals");
|
||||
}
|
||||
|
||||
public IActionResult WithdrawalRequest()
|
||||
[HttpGet]
|
||||
public IActionResult WithdrawalRequest(int? withdrawal, int? request)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Withdrawals = APIClient.GetRequest<List<WithdrawalViewModel>>($"api/withdrawal/getwithdrawallist?managerid={APIClient.Client.Id}");
|
||||
ViewBag.Requests = APIClient.GetRequest<List<RequestViewModel>>($"api/request/getrequestlist");
|
||||
if (request != null && withdrawal != null)
|
||||
{
|
||||
APIClient.GetRequest<bool>($"api/withdrawal/linkwithdrawalrequest?withdrawalid={withdrawal}&requestid={request}");
|
||||
return Redirect("Withdrawals");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region//работа с отчётами
|
||||
public IActionResult RequestsListReport()
|
||||
#region//работа с отчётами
|
||||
public IActionResult RequestsListReport()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
|
@ -6,8 +6,8 @@ namespace BankManagersClientApp
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
@ -8,7 +8,12 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Выдача:</div>
|
||||
<div class="col-8">
|
||||
<select id="withdrawal" name="withdrawal" class="form-control" asp-items="@(new SelectList(@ViewBag.Withdrawals, "Id", "Id"))"></select>
|
||||
<select id="withdrawal" name="withdrawal" class="form-control">
|
||||
@foreach (var withdrawal in ViewBag.Withdrawals)
|
||||
{
|
||||
<option value="@withdrawal.Id">@withdrawal.Id: @withdrawal.WithdrawalTime, @withdrawal.Sum рублей</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -4,19 +4,27 @@
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Привязывание выдачи к заявке</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<form method="get">
|
||||
<div class="row">
|
||||
<div class="col-4">Выдача:</div>
|
||||
<div class="col-8">
|
||||
<select name="request" id="request" class="form-control"
|
||||
asp-items="@(new SelectList(@ViewBag.Withdrawals, "Id", "Id"))"></select>
|
||||
<select id="withdrawal" name="withdrawal" class="form-control">
|
||||
@foreach (var withdrawal in ViewBag.Withdrawals)
|
||||
{
|
||||
<option value="@withdrawal.Id">@withdrawal.Id: @withdrawal.WithdrawalTime, @withdrawal.Sum рублей</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Заявка:</div>
|
||||
<div class="col-8">
|
||||
<select name="request" id="request" class="form-control"
|
||||
asp-items="@(new SelectList(@ViewBag.Requests, "Id", "Id"))"></select>
|
||||
<select id="request" name="request" class="form-control">
|
||||
@foreach (var request in ViewBag.Requests)
|
||||
{
|
||||
<option value="@request.Id">@request.Id: @request.RequestTime, @request.Sum рублей, @request.Status</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -8,7 +8,12 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Выдача:</div>
|
||||
<div class="col-8">
|
||||
<select id="withdrawal" name="withdrawal" class="form-control" asp-items="@(new SelectList(@ViewBag.Withdrawals, "Id", "Id"))"></select>
|
||||
<select id="withdrawal" name="withdrawal" class="form-control">
|
||||
@foreach (var withdrawal in ViewBag.Withdrawals)
|
||||
{
|
||||
<option value="@withdrawal.Id">@withdrawal.Id: @withdrawal.WithdrawalTime, @withdrawal.Sum рублей</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -31,7 +36,35 @@
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
||||
<input type="submit" value="Обновить" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var withdrawal = $('#withdrawal').val();
|
||||
$("#accounts option:selected").removeAttr("selected");
|
||||
if (withdrawal) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetAccounts",
|
||||
data: { withdrawalId: withdrawal },
|
||||
success: function (result) {
|
||||
$.map(result, function (n) {
|
||||
$(`#accounts option[value=${n}]`).attr("selected", "selected")
|
||||
});
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#withdrawal').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
@ -35,9 +35,26 @@ namespace BankRestApi.Controllers
|
||||
_logger.LogError(ex, "Ошибка получения списка счетов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpGet]
|
||||
public List<int> GetAccounts(int withdrawalId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadAccountIdsByWithdrawal(new AccountSearchModel
|
||||
{
|
||||
WithdrawalId = withdrawalId,
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка менеджеров");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public AccountViewModel? GetAccount(int AccountId)
|
||||
{
|
||||
try
|
||||
|
@ -19,10 +19,17 @@ namespace BankRestApi.Controllers
|
||||
_logic = Request;
|
||||
}
|
||||
[HttpGet]
|
||||
public List<RequestViewModel>? GetRequestList(int clientId)
|
||||
public List<RequestViewModel>? GetRequestList(int? clientId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (clientId == null)
|
||||
{
|
||||
List<RequestViewModel> list = _logic.ReadList(null, clientId) ?? new();
|
||||
foreach(RequestViewModel r in list)
|
||||
r.CardRequests = null;
|
||||
return list;
|
||||
}
|
||||
return _logic.ReadList(null, clientId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -20,11 +20,14 @@ namespace BankRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<WithdrawalViewModel>? getWithdrawalList()
|
||||
public List<WithdrawalViewModel>? getWithdrawalList(int managerId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
return _logic.ReadList(new WithdrawalSearchModel
|
||||
{
|
||||
ManagerId = managerId,
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -76,9 +79,23 @@ namespace BankRestApi.Controllers
|
||||
_logger.LogError(ex, "Ошибка обновления выдачи");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HttpGet]
|
||||
public bool LinkWithdrawalRequest(int withdrawalId, int requestId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.LinkToRequest(withdrawalId, requestId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при связывании операции с переводом");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteWithdrawal(WithdrawalBindingModel model)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user