CourseWork_BankYouBankrupt/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/CashWithdrawal.cs

47 lines
1.0 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 CashWithdrawal : ICashWithdrawalModel
{
public int Id { get; set; }
[Required]
public int AccountId { get; set; }
[Required]
public int Sum { get; set; }
[Required]
public DateTime DateOperation { get; set; }
public static CashWithdrawal Create(BankYouBancruptDatabase context, CashWithdrawalBindingModel model)
{
return new CashWithdrawal()
{
Id = model.Id,
AccountId = model.AccountId,
Sum = model.Sum,
DateOperation = model.DateOperation
};
}
public CashWithdrawalViewModel GetViewModel => new()
{
Id = Id,
AccountId = AccountId,
Sum = Sum,
DateOperation = DateOperation
};
}
}