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