52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using BankYouBankruptContracts.BindingModels;
|
|
using BankYouBankruptContracts.ViewModels;
|
|
using BankYouBankruptDataModels.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BankYouBankruptDatabaseImplement.Models
|
|
{
|
|
public class MoneyTransfer : IMoneyTransferModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
public int Sum { get; set; }
|
|
|
|
[Required]
|
|
public int AccountSenderId { get; set; }
|
|
|
|
[Required]
|
|
public int AccountPayeeId { get; set; }
|
|
|
|
[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,
|
|
DateOperation = model.DateOperation
|
|
};
|
|
}
|
|
|
|
public MoneyTransferViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
AccountPayeeId = AccountPayeeId,
|
|
AccountSenderId = AccountSenderId,
|
|
DateOperation = DateOperation,
|
|
Sum = Sum
|
|
};
|
|
}
|
|
}
|