using BankDataModels; using System.ComponentModel; using System.Text; using System.Text.Json.Serialization; namespace BankContracts.ViewModels { public class OperationViewModel : IOperationModel { public int Id { get; set; } public int EmployeeId { get; set; } [DisplayName("Номер телефона сотрудника")] public string EmployeePhoneNumber { get; set; } = string.Empty; [DisplayName("Стоимость")] public double Price { get; set; } [DisplayName("Вид операции")] public string Model { get; set; } = string.Empty; [DisplayName("Тип операции")] public string Mark { get; set; } = string.Empty; [JsonIgnore] public List Purchases { get; set; } = new(); public override string ToString() { var result = new StringBuilder(); foreach (var purchase in Purchases) { result.Append($"Операция вида {Model},Типа {Mark}, Купленная {purchase.DatePurchase.ToShortDateString()}," + $"в покупе c id: {purchase.Id}\n"); } return result.ToString(); } } }