change IWithdrawalModel
This commit is contained in:
parent
c0a6ad9f08
commit
db07c95d36
@ -12,7 +12,6 @@ namespace BankContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public DateTime WithdrawalTime { get; set; } = DateTime.Now;
|
||||
public int? RequestId { get; set; }
|
||||
|
||||
public Dictionary<int, IAccountModel> WithdrawalAccounts = new Dictionary<int, IAccountModel>();
|
||||
public Dictionary<int, (IAccountModel, int)> WithdrawalAccounts { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ namespace BankContracts.ViewModels
|
||||
public DateTime WithdrawalTime { get; set; } = DateTime.Now;
|
||||
[DisplayName("Номер заявки")]
|
||||
public int? RequestId { get; set; }
|
||||
public Dictionary<int, IAccountModel> WithdrawalAccounts { get; set; } = new();
|
||||
public Dictionary<int, (IAccountModel, int)> WithdrawalAccounts { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,6 @@ namespace BankDataModels.Models
|
||||
{
|
||||
DateTime WithdrawalTime { get; set; }
|
||||
int? RequestId { get; set; }
|
||||
Dictionary<int, IAccountModel> WithdrawalAccounts { get; }
|
||||
Dictionary<int, (IAccountModel, int)> WithdrawalAccounts { get; }
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ namespace BankDatabaseImplement.Models
|
||||
public int AccountId { get; set; }
|
||||
[Required]
|
||||
public int WithdrawalId { get; set; }
|
||||
[Required]
|
||||
public int Sum { get; set; }
|
||||
public virtual Account Account { get; set; } = new();
|
||||
public virtual Withdrawal Withdrawal { get; set; } = new();
|
||||
}
|
||||
|
@ -21,15 +21,18 @@ namespace BankDatabaseImplement.Models
|
||||
public virtual Request? Request { get; set; } = null;
|
||||
[ForeignKey("WithdrawalId")]
|
||||
public virtual List<AccountWithdrawal> Accounts { get; set; } = new();
|
||||
private Dictionary<int, IAccountModel>? _withdrawalAccounts { get; set; } = null;
|
||||
private Dictionary<int, (IAccountModel, int)>? _withdrawalAccounts { get; set; } = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IAccountModel> WithdrawalAccounts
|
||||
public Dictionary<int, (IAccountModel, int)> WithdrawalAccounts
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_withdrawalAccounts == null)
|
||||
{
|
||||
_withdrawalAccounts = Accounts.ToDictionary(x => x.AccountId, x => x.Account as IAccountModel);
|
||||
_withdrawalAccounts = Accounts.ToDictionary(
|
||||
x => x.AccountId,
|
||||
x => (x.Account as IAccountModel, x.Sum)
|
||||
);
|
||||
}
|
||||
return _withdrawalAccounts;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user