using BankDataModels.Models; using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; using BankContracts.BindingModels; using BankContracts.ViewModels; namespace BankDatabaseImplement.Models { public class Deposit : IDepositModel { public int Id { get; set; } [Required] public double Sum { get; set; } [Required] public DateOnly OpeningDate { get; set; } public virtual List DepositCurrencies { get; set; } = null!; public virtual List ClientDeposits { get; set; } = null!; public virtual List Refills { get; set; } = null!; public static Deposit? Create(DepositBindingModel model) { if (model == null) return null; return new Deposit { Id = model.Id, Sum = model.Sum, }; } public void Update(DepositBindingModel model) { if (model == null) return; Id = model.Id; Sum = model.Sum; } public DepositViewModel GetViewModel => new() { Id = Id, Sum = Sum, }; } }