2023-05-18 21:57:14 +04:00
|
|
|
|
using BankYouBankruptClientApp.Models;
|
2023-05-16 20:05:59 +04:00
|
|
|
|
using BankYouBankruptContracts.BindingModels;
|
|
|
|
|
using BankYouBankruptContracts.ViewModels;
|
2023-05-18 17:56:47 +04:00
|
|
|
|
using BankYouBankruptContracts.ViewModels.Client.Default;
|
|
|
|
|
using BankYouBankruptContracts.ViewModels.Client.Reports;
|
|
|
|
|
using BankYouBankruptContracts.ViewModels.Client.Diagram;
|
2023-05-17 15:18:35 +04:00
|
|
|
|
using BankYouBankruptDataModels.Enums;
|
2023-05-16 20:05:59 +04:00
|
|
|
|
using BankYouBankruptСlientApp;
|
2023-03-31 20:13:22 +04:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-05-18 21:57:14 +04:00
|
|
|
|
using PdfSharp.Drawing;
|
|
|
|
|
using PdfSharp.Pdf;
|
|
|
|
|
using PdfSharp.Pdf.IO;
|
|
|
|
|
using System.Collections;
|
2023-03-31 20:13:22 +04:00
|
|
|
|
using System.Diagnostics;
|
2023-05-18 21:57:14 +04:00
|
|
|
|
using System.Reflection;
|
2023-05-16 20:05:59 +04:00
|
|
|
|
using System.Xml.Linq;
|
2023-05-18 21:57:14 +04:00
|
|
|
|
using static System.Net.Mime.MediaTypeNames;
|
2023-03-31 20:13:22 +04:00
|
|
|
|
|
|
|
|
|
namespace BankYouBankruptClientApp.Controllers
|
|
|
|
|
{
|
2023-05-18 00:10:14 +04:00
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
2023-04-02 01:17:44 +04:00
|
|
|
|
private readonly ILogger<HomeController> _logger;
|
2023-03-31 20:13:22 +04:00
|
|
|
|
|
2023-04-02 01:17:44 +04:00
|
|
|
|
public HomeController(ILogger<HomeController> logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
2023-03-31 20:13:22 +04:00
|
|
|
|
|
2023-05-18 17:56:47 +04:00
|
|
|
|
#region Профиль, вход и регистрация
|
2023-05-17 01:00:04 +04:00
|
|
|
|
[HttpGet]
|
2023-05-19 17:00:13 +04:00
|
|
|
|
public IActionResult Enter()
|
2023-05-17 01:00:04 +04:00
|
|
|
|
{
|
2023-05-19 17:00:13 +04:00
|
|
|
|
return View();
|
2023-05-16 20:05:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
|
public IActionResult Error()
|
|
|
|
|
{
|
|
|
|
|
return View(new ErrorViewModel
|
|
|
|
|
{
|
|
|
|
|
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
2023-05-19 17:00:13 +04:00
|
|
|
|
public IActionResult Login()
|
2023-04-02 01:17:44 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2023-03-31 20:13:22 +04:00
|
|
|
|
|
2023-05-17 01:00:04 +04:00
|
|
|
|
|
2023-05-16 20:05:59 +04:00
|
|
|
|
[HttpPost]
|
2023-05-19 17:00:13 +04:00
|
|
|
|
public void Login(string login, string password)
|
2023-05-16 20:05:59 +04:00
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите логин и пароль");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/Client/Login?login={login}&password={password}");
|
|
|
|
|
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Неверный логин/пароль");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 17:00:13 +04:00
|
|
|
|
Response.Redirect("Enter");
|
2023-05-16 20:05:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 01:00:04 +04:00
|
|
|
|
|
2023-05-16 20:05:59 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Register()
|
2023-04-02 01:17:44 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2023-03-31 20:13:22 +04:00
|
|
|
|
|
2023-05-17 01:00:04 +04:00
|
|
|
|
|
2023-05-16 20:05:59 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Register(string login, string password, string name, string surname, string patronymic, string telephone)
|
2023-04-02 01:17:44 +04:00
|
|
|
|
{
|
2023-05-18 00:10:14 +04:00
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name)
|
2023-05-16 20:05:59 +04:00
|
|
|
|
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic) || string.IsNullOrEmpty(telephone))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите логин, пароль, ФИО и телефон");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Client/Register", new ClientBindingModel
|
|
|
|
|
{
|
|
|
|
|
Name = name,
|
|
|
|
|
Surname = surname,
|
|
|
|
|
Patronymic = patronymic,
|
|
|
|
|
Email = login,
|
|
|
|
|
Password = password,
|
|
|
|
|
Telephone = telephone
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Response.Redirect("Enter");
|
|
|
|
|
|
|
|
|
|
return;
|
2023-04-02 01:17:44 +04:00
|
|
|
|
}
|
2023-05-19 19:47:30 +04:00
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult Logout() {
|
|
|
|
|
APIClient.Client = null;
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 22:23:50 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Privacy()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return View(APIClient.Client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Privacy(string login, string password, string name, string surname, string patronymic, string telephone)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name)
|
|
|
|
|
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic)
|
|
|
|
|
|| string.IsNullOrEmpty(telephone))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите логин, пароль, ФИО и телефон");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("/api/Client/UpdateData", new ClientBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = APIClient.Client.Id,
|
|
|
|
|
Name = name,
|
|
|
|
|
Surname = surname,
|
|
|
|
|
Patronymic = patronymic,
|
|
|
|
|
Telephone = telephone,
|
|
|
|
|
Email = login,
|
|
|
|
|
Password = password
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
APIClient.Client.Name = name;
|
|
|
|
|
APIClient.Client.Surname = surname;
|
|
|
|
|
APIClient.Client.Patronymic = patronymic;
|
|
|
|
|
APIClient.Client.Email = login;
|
|
|
|
|
APIClient.Client.Password = password;
|
|
|
|
|
APIClient.Client.Telephone = telephone;
|
|
|
|
|
|
|
|
|
|
Response.Redirect("Enter");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-18 17:56:47 +04:00
|
|
|
|
#endregion
|
2023-05-17 01:00:04 +04:00
|
|
|
|
|
2023-05-17 14:27:46 +04:00
|
|
|
|
#region Карты
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult CardsList()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return View(APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}"));
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 01:00:04 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult CreateCard() {
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 15:18:35 +04:00
|
|
|
|
ViewBag.Accounts = APIClient.GetRequest<List<AccountViewModel>>($"api/Account/SearchAccountsOfCLient?clientId={APIClient.Client.Id}");
|
2023-05-17 01:00:04 +04:00
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
2023-05-17 15:18:35 +04:00
|
|
|
|
public IActionResult CreateCard(string accountId, string number, string cvc, string period) {
|
2023-05-17 01:00:04 +04:00
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Card/CreateCard", new CardBindingModel {
|
|
|
|
|
ClientID = APIClient.Client.Id,
|
2023-05-17 15:18:35 +04:00
|
|
|
|
AccountId = int.Parse(accountId),
|
2023-05-17 01:00:04 +04:00
|
|
|
|
Number = number,
|
|
|
|
|
CVC = cvc,
|
|
|
|
|
Period = DateTime.Parse(period)
|
|
|
|
|
});
|
|
|
|
|
|
2023-05-17 14:27:46 +04:00
|
|
|
|
return Redirect("~/Home/CardsList");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2023-05-17 15:18:35 +04:00
|
|
|
|
#region Снятие средств
|
|
|
|
|
|
2023-05-17 14:27:46 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult DebitingList()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return View(APIClient.GetRequest<List<DebitingViewModel>>($"api/Client/getUsersDebitings?userId={APIClient.Client.Id}"));
|
2023-05-17 01:00:04 +04:00
|
|
|
|
}
|
2023-05-17 15:18:35 +04:00
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult CreateDebiting()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult CreateDebiting(string cardId, int sum)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Card/CreateDebitingRequest", new DebitingBindingModel()
|
|
|
|
|
{
|
|
|
|
|
CardId = int.Parse(cardId),
|
|
|
|
|
Sum = sum,
|
|
|
|
|
DateOpen = DateTime.Now,
|
|
|
|
|
Status = StatusEnum.Открыта
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Redirect("~/Home/DebitingList");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Пополнение средств
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult CreditingList()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return View(APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}"));
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 15:24:20 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult CreateCrediting()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2023-05-19 01:53:16 +04:00
|
|
|
|
|
|
|
|
|
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
|
|
|
|
return View();
|
2023-05-17 15:24:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult CreateCrediting(string cardId, int sum)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Card/CreateCreditingOperation", new CreditingBindingModel()
|
|
|
|
|
{
|
|
|
|
|
CardId = int.Parse(cardId),
|
|
|
|
|
Sum = sum,
|
|
|
|
|
DateOpen = DateTime.Now,
|
|
|
|
|
Status = StatusEnum.Открыта
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Redirect("~/Home/CreditingList");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 15:18:35 +04:00
|
|
|
|
#endregion
|
2023-05-18 00:04:33 +04:00
|
|
|
|
|
2023-05-18 00:47:56 +04:00
|
|
|
|
#region Получение отчёта PDF
|
2023-05-18 00:04:33 +04:00
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult CreateReport()
|
|
|
|
|
{
|
2023-05-18 00:47:56 +04:00
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 01:12:27 +04:00
|
|
|
|
return View();
|
2023-05-18 00:10:14 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
2023-05-18 21:57:14 +04:00
|
|
|
|
public IActionResult CreateReport(DateTime dateFrom, DateTime dateTo)
|
2023-05-18 00:10:14 +04:00
|
|
|
|
{
|
2023-05-18 00:47:56 +04:00
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
2023-05-18 00:10:14 +04:00
|
|
|
|
|
2023-05-19 02:18:52 +04:00
|
|
|
|
//ViewBag.DataOfClientReport = APIClient.GetRequest<ReportClientViewModelForHTML>($"api/Report/GetDataOfClientReport");
|
|
|
|
|
|
|
|
|
|
return View(APIClient.PostRequestReport<ReportClientViewModelForHTML, ReportSupportBindingModel>("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
2023-05-18 00:47:56 +04:00
|
|
|
|
{
|
|
|
|
|
DateFrom = dateFrom,
|
|
|
|
|
DateTo = dateTo
|
2023-05-19 02:18:52 +04:00
|
|
|
|
}));
|
2023-05-18 12:55:48 +04:00
|
|
|
|
}
|
2023-05-18 00:10:14 +04:00
|
|
|
|
|
2023-05-18 21:57:14 +04:00
|
|
|
|
#endregion
|
|
|
|
|
|
2023-05-19 13:04:22 +04:00
|
|
|
|
#region Excel отчёт
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
2023-05-19 20:11:24 +04:00
|
|
|
|
public IActionResult CreateExcelReport(List<CheckboxViewModel> cards)
|
2023-05-19 13:04:22 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Report/CreateExcelClient", new ReportSupportBindingModel()
|
|
|
|
|
{
|
2023-05-19 18:06:21 +04:00
|
|
|
|
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
2023-05-19 13:04:22 +04:00
|
|
|
|
});
|
|
|
|
|
|
2023-05-19 20:11:24 +04:00
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult CreateCreditingExcelReport(List<CheckboxViewModel> cards)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Report/CreateExcelCrediting", new ReportSupportBindingModel()
|
|
|
|
|
{
|
|
|
|
|
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Redirect("~/Home/Enter");
|
2023-05-19 13:04:22 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 20:32:27 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult CreateDebitingExcelReport(List<CheckboxViewModel> cards)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не авторизованы");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/Report/CreateExcelDebiting", new ReportSupportBindingModel()
|
|
|
|
|
{
|
|
|
|
|
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 13:04:22 +04:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Получение отчета по картам
|
|
|
|
|
[HttpGet]
|
2023-05-17 18:49:15 +04:00
|
|
|
|
public IActionResult ReportWithCards()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 20:04:01 +04:00
|
|
|
|
return View(new ReportClientCardsViewModel()
|
|
|
|
|
{
|
2023-05-18 00:10:14 +04:00
|
|
|
|
Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}").Select(x => new CheckboxViewModel() {
|
2023-05-17 20:04:01 +04:00
|
|
|
|
Id = x.Id,
|
|
|
|
|
LabelName = x.Number,
|
|
|
|
|
IsChecked = false
|
|
|
|
|
}).ToList()
|
2023-05-18 00:10:14 +04:00
|
|
|
|
});
|
2023-05-18 00:04:33 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
2023-05-17 20:04:01 +04:00
|
|
|
|
public IActionResult ReportWithCards(List<CheckboxViewModel> cards)
|
2023-05-18 00:04:33 +04:00
|
|
|
|
{
|
2023-05-17 20:04:01 +04:00
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<int> cardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList();
|
2023-05-18 00:47:56 +04:00
|
|
|
|
|
2023-05-17 20:04:01 +04:00
|
|
|
|
List<ReportViewModel> creditings = APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}")
|
2023-05-18 00:10:14 +04:00
|
|
|
|
.Where(x => cardList.Contains(x.CardId)).Select(x => new ReportViewModel() {
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
CardId = x.CardId,
|
|
|
|
|
DateOpen = x.DateOpen,
|
|
|
|
|
DateClose = x.DateClose,
|
|
|
|
|
CardNumber = x.CardNumber,
|
2023-05-17 20:04:01 +04:00
|
|
|
|
Status = x.Status,
|
|
|
|
|
Sum = x.Sum,
|
|
|
|
|
TypeOperation = TypeOperationEnum.Пополнение
|
|
|
|
|
}).ToList();
|
2023-05-18 00:47:56 +04:00
|
|
|
|
|
2023-05-17 20:04:01 +04:00
|
|
|
|
List<ReportViewModel> debitings = APIClient.GetRequest<List<DebitingViewModel>>($"api/Client/getUsersDebitings?userId={APIClient.Client.Id}")
|
|
|
|
|
.Where(x => cardList.Contains(x.CardId)).Select(x => new ReportViewModel()
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
CardId = x.CardId,
|
|
|
|
|
DateOpen = x.DateOpen,
|
|
|
|
|
DateClose = x.DateClose,
|
|
|
|
|
CardNumber = x.CardNumber,
|
|
|
|
|
Status = x.Status,
|
|
|
|
|
Sum = x.Sum,
|
|
|
|
|
TypeOperation = TypeOperationEnum.Снятие
|
|
|
|
|
}).ToList();
|
2023-05-18 00:47:56 +04:00
|
|
|
|
|
2023-05-17 20:04:01 +04:00
|
|
|
|
List<ReportViewModel> result = creditings.Concat(debitings).OrderBy(x => x.DateOpen).ToList();
|
|
|
|
|
|
|
|
|
|
return View(new ReportClientCardsViewModel()
|
|
|
|
|
{
|
|
|
|
|
Cards = cards,
|
|
|
|
|
Operations = result,
|
2023-05-18 00:10:14 +04:00
|
|
|
|
});
|
2023-05-18 00:08:30 +04:00
|
|
|
|
}
|
2023-05-18 17:56:47 +04:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Diagram() {
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
|
|
|
|
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult Diagram(int cardId)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Client == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return View(new ClientDiagramViewModel() {
|
|
|
|
|
DiagramName = "Hello World",
|
|
|
|
|
Elements = APIClient.GetRequest<List<ClientDiagramElementsViewModel>>($"api/Card/getCardMonthResult?cardId={cardId}")
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-05-18 00:10:14 +04:00
|
|
|
|
}
|
|
|
|
|
}
|