CourseWork_Bank/Bank/BankContracts/ViewModels/OperationViewModel.cs

33 lines
1.2 KiB
C#
Raw Normal View History

2024-04-28 21:34:43 +04:00
using BankDataModels;
using System.ComponentModel;
using System.Text;
2024-04-28 21:34:43 +04:00
using System.Text.Json.Serialization;
namespace BankContracts.ViewModels
{
2024-04-28 21:34:43 +04:00
public class OperationViewModel : IOperationModel
{
2024-04-28 21:34:43 +04:00
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<PurchaseViewModel> 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();
}
}
2024-04-28 21:34:43 +04:00
}