Отчеты начали сохраняться
This commit is contained in:
parent
ca859d9bc5
commit
fc176b907a
@ -4,6 +4,7 @@ using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankDatabaseImplement.Models;
|
||||
using BankDataModels.Models;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using System.Diagnostics;
|
||||
@ -523,14 +524,18 @@ namespace BankClientApp.Controllers
|
||||
case "word":
|
||||
APIClient.PostRequest($"api/report/savetransferstoword", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\Users\\123\\Desktop\\wordfile.docx",
|
||||
SelectedCardIds = cards,
|
||||
});
|
||||
Response.Redirect("TransferListReport");
|
||||
break;
|
||||
case "excel":
|
||||
APIClient.PostRequest($"api/report/savetransferstoword", new ReportBindingModel
|
||||
{
|
||||
FileName = "C:\\Users\\123\\Desktop\\wordfile.docx",
|
||||
SelectedCardIds = cards,
|
||||
});
|
||||
Response.Redirect("TransferListReport");
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using BankContracts.StoragesContracts;
|
||||
using BankContracts.ViewModels;
|
||||
using BankDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
|
||||
namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
@ -50,8 +51,8 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
CardNumber = t.Number,
|
||||
Transfers = context.Transfers
|
||||
.Include(c => c.Operation)
|
||||
.Where(x => x.Operation == null || x.Operation.SenderCardId == model.Id || x.Operation.RecipientCardId == model.Id)
|
||||
.Include(c => c.Operation).Include(c => c.RecipientAccount).Include(c => c.SenderAccount)
|
||||
.Where(x => x.Operation == null || model.SelectedCardIds == null || model.SelectedCardIds.Contains((int)x.Operation.SenderCardId) || model.SelectedCardIds.Contains((int)x.Operation.RecipientCardId))
|
||||
.Select(t => t.GetViewModel)
|
||||
.ToList()
|
||||
}).ToList();
|
||||
|
@ -85,10 +85,14 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
var transfer = context.Transfers.Include(x => x.SenderAccount).Include(x => x.RecipientAccount).Include(x => x.Operation).FirstOrDefault(rec => rec.Id == transferId);
|
||||
if (transfer == null || operationId <= 0)
|
||||
if (transfer == null || operationId <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (transfer.OperationId != null || context.Transfers.Where(x => x.OperationId == operationId).Count() > 0 )
|
||||
{
|
||||
throw new Exception("Невозможно связать выбранные сущности");
|
||||
}
|
||||
var newTransfer = new TransferBindingModel
|
||||
{
|
||||
Sum = transfer.Sum,
|
||||
|
Loading…
Reference in New Issue
Block a user