Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
eca89f4549
@ -210,7 +210,12 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
||||
|
||||
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetAllCards").Select(x => new ClientCardViewModel
|
||||
{
|
||||
Id = x.Id,
|
||||
FullName = x.ClientSurname + " " +x.Number.ToString()
|
||||
}).ToList();
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Номер счета:</div>
|
||||
<div class="col-8">
|
||||
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "Number"))"></select>
|
||||
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "FullName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -0,0 +1,17 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptContracts.ViewModels
|
||||
{
|
||||
public class ClientCardViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -31,6 +31,22 @@ namespace BankYouBankruptRestApi.Controllers
|
||||
_accountLogic = accountLogic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<CardViewModel>? GetAllCards()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _cardLogic.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения карт");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public List<CardViewModel>? GetUsersCardsList(int id)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user