2020-04-27 09:26:45 +00:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
2020-04-23 11:27:32 +00:00
|
|
|
namespace Bücherwurm
|
|
|
|
{
|
2020-04-28 13:58:27 +00:00
|
|
|
public class Book : IProduct
|
2020-04-23 11:27:32 +00:00
|
|
|
{
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("title")]
|
2020-04-28 13:11:31 +00:00
|
|
|
public string Name {get; set;}
|
2020-04-23 11:27:32 +00:00
|
|
|
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("author")]
|
2020-04-23 11:27:32 +00:00
|
|
|
public string Author {get; set;}
|
|
|
|
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("country")]
|
2020-04-23 11:27:32 +00:00
|
|
|
public string Country {get; set;}
|
|
|
|
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("link")]
|
2020-04-23 11:27:32 +00:00
|
|
|
public string Link {get; set;}
|
|
|
|
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("language")]
|
2020-04-23 11:27:32 +00:00
|
|
|
public string Language {get; set;}
|
|
|
|
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("pages")]
|
2020-04-23 11:27:32 +00:00
|
|
|
public int Pages {get; set;}
|
|
|
|
|
2020-04-27 09:26:45 +00:00
|
|
|
[JsonPropertyName("year")]
|
2020-04-23 11:27:32 +00:00
|
|
|
public int Year {get; set;}
|
2020-04-27 14:14:20 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
public int ProductId { get; set; }
|
|
|
|
[JsonIgnore]
|
2020-04-28 13:29:20 +00:00
|
|
|
public CategoryEnum Category { get; set; }
|
2020-04-27 14:14:20 +00:00
|
|
|
[JsonPropertyName("imageLink")]
|
|
|
|
public string ImageLink { get; set; }
|
2020-04-28 08:54:22 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
public int LendTime {get; set;}
|
2020-04-28 13:36:36 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
public LendTypeEnum LendType {get; set;}
|
2020-04-23 11:27:32 +00:00
|
|
|
|
|
|
|
public Book(int Id, string Title, string Author,
|
|
|
|
string Country, string ILink, string Link, string Language,
|
|
|
|
int Pages, int Year)
|
|
|
|
{
|
2020-04-27 14:14:20 +00:00
|
|
|
ProductId = Id;
|
2020-04-28 13:29:20 +00:00
|
|
|
Category = CategoryEnum.Book;
|
2020-04-28 08:54:22 +00:00
|
|
|
LendTime = 30;
|
2020-04-28 13:36:36 +00:00
|
|
|
LendType = LendTypeEnum.Physical;
|
2020-04-28 13:11:31 +00:00
|
|
|
this.Name = Title;
|
2020-04-23 11:27:32 +00:00
|
|
|
this.Author = Author;
|
|
|
|
this.Country = Country;
|
|
|
|
ImageLink = ILink;
|
|
|
|
this.Link = Link;
|
|
|
|
this.Language = Language;
|
|
|
|
this.Pages = Pages;
|
|
|
|
this.Year = Year;
|
|
|
|
}
|
2020-04-27 09:26:45 +00:00
|
|
|
|
|
|
|
public Book()
|
|
|
|
{
|
2020-04-28 13:29:20 +00:00
|
|
|
Category = CategoryEnum.Book;
|
2020-04-28 09:04:31 +00:00
|
|
|
LendTime = 30;
|
2020-04-28 13:36:36 +00:00
|
|
|
LendType = LendTypeEnum.Physical;
|
2020-04-27 09:26:45 +00:00
|
|
|
}
|
2020-04-27 14:14:20 +00:00
|
|
|
|
|
|
|
public void OverwriteNullId(int id)
|
2020-04-27 09:26:45 +00:00
|
|
|
{
|
2020-04-27 14:14:20 +00:00
|
|
|
if (ProductId == 0)
|
2020-04-27 09:26:45 +00:00
|
|
|
{
|
2020-04-27 14:14:20 +00:00
|
|
|
ProductId = id;
|
2020-04-27 09:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-23 11:27:32 +00:00
|
|
|
}
|
|
|
|
}
|