using AccountsContracts.BindingModels; using AccountsContracts.ViewModels; using AccountsDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AccountsDataBaseImplement.Models { public class Interest : IInterestModel { public int Id { get; private set; } [Required] public string Name { get; private set; } = string.Empty; public static Interest? Create(InterestBindingModel? model) { if (model == null) { return null; } return new Interest() { Id = model.Id, Name = model.Name, }; } public static Interest? Create(InterestViewModel? model) { return new Interest() { Id = model.Id, Name = model.Name, }; } public void Update(InterestBindingModel? model) { if (model == null) { return; } Name = model.Name; } public InterestViewModel GetViewModel => new() { Id = Id, Name = Name, }; } }