PIbd-33_Sergunov_M.A._COP_4/Library/LibraryDatabaseImplement/Models/Book.cs

39 lines
862 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;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibraryDatabaseImplement.Models
{
public class Book
{
public int Id { get; set; }
[Required]
public string Title { get; set; }
[Required]
public string Description { get; set; }
[Required]
public string Genre { get; set; }
[Required]
public int? Cost { get; set; }
public string CostStr
{
set { }
get
{
if (Cost == 0) return "Бесплатная";
else if (Cost == null) return "Не указано";
else return Cost.ToString();
}
}
}
}