PIbd-33_Sergunov_M.A._COP_4/Library/LibraryContracts/ViewModels/BookViewModel.cs

38 lines
982 B
C#
Raw Normal View History

2023-11-17 09:56:34 +04:00
using System.ComponentModel;
namespace LibraryContracts.ViewModels
{
public class BookViewModel
{
public int? Id { get; set; }
[DisplayName("Название")]
public string Title { get; set; }
[DisplayName("Описание")]
public string Description { get; set; }
[DisplayName("Жанр")]
public string Genre { get; set; }
[DisplayName("Стоимость")]
public int? Cost { get; set; }
public string CostStr
{
set
{
if (Cost == 0) CostStr = "Бесплатная";
else if (Cost == null) CostStr = "Не указано";
else CostStr = value;
}
get
{
if (Cost == 0) return "Бесплатная";
else if (Cost == null) return "Не указано";
else return Cost.ToString();
}
}
}
}