Buecherwurm/Book.cs
2020-04-29 11:30:49 +02:00

78 lines
No EOL
2 KiB
C#

using System.Text.Json.Serialization;
namespace Bücherwurm
{
public class Book : IProduct
{
[JsonPropertyName("title")]
public string Name {get; set;}
[JsonPropertyName("author")]
public string Author {get; set;}
[JsonPropertyName("country")]
public string Country {get; set;}
[JsonPropertyName("link")]
public string Link {get; set;}
[JsonPropertyName("language")]
public string Language {get; set;}
[JsonPropertyName("pages")]
public int Pages {get; set;}
[JsonPropertyName("year")]
public int Year {get; set;}
[JsonIgnore]
public int ProductId { get; set; }
[JsonIgnore]
public CategoryEnum Category { get; set; }
[JsonPropertyName("imageLink")]
public string ImageLink { get; set; }
[JsonIgnore]
public int LendTime {get; set;}
[JsonIgnore]
public LendTypeEnum LendType {get; set;}
public Book(
int Id,
string Title,
string Author,
string Country,
string ILink,
string Link,
string Language,
int Pages,
int Year)
{
ProductId = Id;
Category = CategoryEnum.Book;
LendTime = 30;
LendType = LendTypeEnum.Physical;
this.Name = Title;
this.Author = Author;
this.Country = Country;
ImageLink = ILink;
this.Link = Link;
this.Language = Language;
this.Pages = Pages;
this.Year = Year;
}
public Book()
{
Category = CategoryEnum.Book;
LendTime = 30;
LendType = LendTypeEnum.Physical;
}
public void OverwriteNullId(int id)
{
if (ProductId == 0)
{
ProductId = id;
}
}
}
}