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

38 lines
982 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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();
}
}
}
}