Save of diagrams.
This commit is contained in:
parent
5f765a77cf
commit
a46290e4d4
@ -151,23 +151,28 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
AccountId = AccountId,
|
AccountId = AccountId,
|
||||||
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
||||||
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
||||||
Dictionary<(int, int), int> moneyTransfersDebiting = _moneyTransferLogic.ReadList(new MoneyTransferSearchModel()
|
|
||||||
|
Dictionary<(int, int), int> moneyTransfers = _moneyTransferLogic.ReadList(new MoneyTransferSearchModel()
|
||||||
{
|
{
|
||||||
AccountPayeeId = AccountId,
|
AccountPayeeId = AccountId,
|
||||||
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
||||||
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
||||||
Dictionary<(int, int), int> moneyTransfers = _moneyTransferLogic.ReadList(new MoneyTransferSearchModel()
|
|
||||||
|
Dictionary<(int, int), int> moneyTransfersDebiting = _moneyTransferLogic.ReadList(new MoneyTransferSearchModel()
|
||||||
{
|
{
|
||||||
AccountSenderId = AccountId,
|
AccountSenderId = AccountId,
|
||||||
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
||||||
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
||||||
|
|
||||||
List<CashierDiagramElementsViewModel> result = new();
|
List<CashierDiagramElementsViewModel> result = new();
|
||||||
foreach (var key in cashWithdrawals.Keys.Union(moneyTransfersDebiting.Keys).Union(moneyTransfers.Keys))
|
|
||||||
|
int sum = 0;
|
||||||
|
|
||||||
|
foreach (var key in cashWithdrawals.Keys.Union(moneyTransfers.Keys).Union(moneyTransfers.Keys))
|
||||||
{
|
{
|
||||||
int sum = 0;
|
if (cashWithdrawals.ContainsKey(key)) sum += cashWithdrawals.GetValueOrDefault(key);
|
||||||
if (cashWithdrawals.ContainsKey(key)) sum -= cashWithdrawals.GetValueOrDefault(key);
|
if (moneyTransfers.ContainsKey(key)) sum += moneyTransfers.GetValueOrDefault(key);
|
||||||
if (moneyTransfersDebiting.ContainsKey(key)) sum += moneyTransfersDebiting.GetValueOrDefault(key);
|
if (moneyTransfers.ContainsKey(key)) sum -= moneyTransfersDebiting.GetValueOrDefault(key);
|
||||||
if (moneyTransfersDebiting.ContainsKey(key)) sum -= moneyTransfersDebiting.GetValueOrDefault(key);
|
|
||||||
result.Add(new CashierDiagramElementsViewModel() { Name = Enum.GetName(typeof(Months), key.Item1) + " " + key.Item2.ToString(), Value = sum });
|
result.Add(new CashierDiagramElementsViewModel() { Name = Enum.GetName(typeof(Months), key.Item1) + " " + key.Item2.ToString(), Value = sum });
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -218,9 +218,8 @@ namespace BankYouBankruptClientApp.Controllers
|
|||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewBag.Cards = View(APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}"));
|
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
||||||
|
return View();
|
||||||
return View();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
Loading…
Reference in New Issue
Block a user