2023-04-01 20:27:26 +04:00
|
|
|
|
using BankYouBankruptContracts.BindingModels;
|
|
|
|
|
using BankYouBankruptContracts.ViewModels;
|
|
|
|
|
using BankYouBankruptDataModels.Models;
|
2023-04-01 15:33:39 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2023-04-01 20:27:26 +04:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Diagnostics;
|
2023-04-01 15:33:39 +04:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BankYouBankruptDatabaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class MoneyTransfer : IMoneyTransferModel
|
|
|
|
|
{
|
2023-04-01 20:27:26 +04:00
|
|
|
|
public int Id { get; set; }
|
2023-04-01 15:33:39 +04:00
|
|
|
|
|
2023-04-01 20:27:26 +04:00
|
|
|
|
[Required]
|
|
|
|
|
public int Sum { get; set; }
|
2023-04-01 15:33:39 +04:00
|
|
|
|
|
2023-04-01 20:27:26 +04:00
|
|
|
|
[Required]
|
|
|
|
|
public int AccountSenderId { get; set; }
|
2023-04-01 15:33:39 +04:00
|
|
|
|
|
2023-04-01 20:49:00 +04:00
|
|
|
|
//для передачи номера счёта отправителя
|
2023-04-01 21:34:22 +04:00
|
|
|
|
//public virtual Account AccountSender { get; set; }
|
2023-04-01 20:49:00 +04:00
|
|
|
|
|
2023-04-01 20:27:26 +04:00
|
|
|
|
[Required]
|
|
|
|
|
public int AccountPayeeId { get; set; }
|
2023-04-01 15:33:39 +04:00
|
|
|
|
|
2023-04-01 20:49:00 +04:00
|
|
|
|
//для передачи номера счёта получателя
|
2023-04-01 21:34:22 +04:00
|
|
|
|
//public virtual Account AccountPayee { get; set; }
|
2023-04-01 20:49:00 +04:00
|
|
|
|
|
2023-04-01 20:27:26 +04:00
|
|
|
|
[Required]
|
|
|
|
|
public DateTime DateOperation { get; set; }
|
|
|
|
|
|
|
|
|
|
public static MoneyTransfer Create(BankYouBancruptDatabase context, MoneyTransferBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
return new MoneyTransfer()
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
Sum = model.Sum,
|
|
|
|
|
AccountSenderId = model.AccountSenderId,
|
|
|
|
|
AccountPayeeId = model.AccountPayeeId,
|
2023-04-01 20:49:00 +04:00
|
|
|
|
DateOperation = model.DateOperation,
|
2023-04-01 21:34:22 +04:00
|
|
|
|
//AccountSender = context.Accounts.First(x => x.Id == model.AccountSenderId),
|
|
|
|
|
//AccountPayee = context.Accounts.First(x => x.Id == model.AccountPayeeId)
|
2023-04-01 20:27:26 +04:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MoneyTransferViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
AccountPayeeId = AccountPayeeId,
|
|
|
|
|
AccountSenderId = AccountSenderId,
|
|
|
|
|
DateOperation = DateOperation,
|
|
|
|
|
Sum = Sum
|
|
|
|
|
};
|
|
|
|
|
}
|
2023-04-01 15:33:39 +04:00
|
|
|
|
}
|