Промежуточный

This commit is contained in:
Artyom_Yashin 2024-05-25 22:37:57 +04:00
parent b550f63649
commit 9ec30179f0
6 changed files with 10 additions and 9 deletions

View File

@ -35,7 +35,7 @@ namespace BankBusinessLogic.BusinessLogic
_logger.LogInformation("ReadList Count: {Count}", list.Count);
return list;
}
public List<CardViewModel>? ReadListByRequestId(CardSearchModel model)
public List<int> ReadListByRequestId(CardSearchModel model)
{
_logger.LogInformation("ReadListByRequestId. Number: {Number}, Id: {Id}", model?.Number, model?.Id);
var list = _cardStorage.GetListForRequest(model);

View File

@ -186,13 +186,13 @@ namespace BankClientApp.Controllers
}
[HttpGet]
public List<CardViewModel>? GetCards(int requestId)
public List<int> GetCards(int requestId)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
var result = APIClient.GetRequest<List<CardViewModel>>($"api/card/getcards?requestid={requestId}");
var result = APIClient.GetRequest<List<int>>($"api/card/getcards?requestid={requestId}");
if (result == null)
{
return default;

View File

@ -13,6 +13,7 @@ namespace BankContracts.BusinessLogicsContracts
{
List<CardViewModel>? ReadList(CardSearchModel? model);
CardViewModel? ReadElement(CardSearchModel model);
List<int> ReadListByRequestId(CardSearchModel model);
bool Create(CardBindingModel model);
bool Update(CardBindingModel model);
bool Delete(CardBindingModel model);

View File

@ -13,7 +13,7 @@ namespace BankContracts.StoragesContracts
{
List<CardViewModel> GetFullList();
List<CardViewModel> GetFilteredList(CardSearchModel model);
List<CardViewModel> GetListForRequest(CardSearchModel model);
List<int> GetListForRequest(CardSearchModel model);
List<ReportTransfersViewModel> GetReportTransfersList(CardSearchModel model);
List<ReportOperationsRequestsViewModel> GetReportOperationsRequestsList(CardSearchModel model);
CardViewModel? GetElement(CardSearchModel model);

View File

@ -30,13 +30,13 @@ namespace BankDatabaseImplement.Implements
.ToList();
}
public List<CardViewModel> GetListForRequest(CardSearchModel model)
public List<int> GetListForRequest(CardSearchModel model)
{
using var context = new BankDatabase();
return context.CardRequests
.Include(x => x.Card).Include(x => x.Request)
.Where(x => x.RequestId==model.RequestId)
.Select(x => x.Card.GetViewModel).ToList();
.Select(x => x.Card.Id).ToList();
}
public List<ReportTransfersViewModel> GetReportTransfersList(CardSearchModel model)

View File

@ -36,12 +36,12 @@ namespace BankRestApi.Controllers
}
}
[HttpPost]
public List<CardViewModel>? GetCards(int requestId)
[HttpGet]
public List<int> GetCards(int requestId)
{
try
{
return _logic.ReadList(new CardSearchModel
return _logic.ReadListByRequestId(new CardSearchModel
{
RequestId = requestId,
});