|
|
|
@ -8,51 +8,79 @@ using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ViewModels
|
|
|
|
|
{
|
|
|
|
|
[ObservableObject]
|
|
|
|
|
public partial class BookVM
|
|
|
|
|
public class BookVM : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region Fields
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string id;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string isbn13;
|
|
|
|
|
#region Properties
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string title;
|
|
|
|
|
public Book Model { get; }
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private List<string> publishers;
|
|
|
|
|
public string Id
|
|
|
|
|
{
|
|
|
|
|
get => Model.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private DateTime publishDate;
|
|
|
|
|
public string ISBN13
|
|
|
|
|
{
|
|
|
|
|
get => Model.ISBN13;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private List<AuthorVM> authors;
|
|
|
|
|
public string Title
|
|
|
|
|
{
|
|
|
|
|
get => Model.Title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string author;
|
|
|
|
|
public List<string> Publishers
|
|
|
|
|
{
|
|
|
|
|
get => Model.Publishers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private Status status;
|
|
|
|
|
public DateTime PublishDate
|
|
|
|
|
{
|
|
|
|
|
get => Model.PublishDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<AuthorVM> Authors
|
|
|
|
|
{
|
|
|
|
|
get => Model.Authors.Select(a => new AuthorVM(a)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private int nbPages;
|
|
|
|
|
public string Author => Model.Authors.Count > 0 ? Model.Authors.First().Name : "Auteur inconnu";
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private Languages language;
|
|
|
|
|
public Status Status
|
|
|
|
|
{
|
|
|
|
|
get => Model.Status;
|
|
|
|
|
set => SetProperty(Model.Status, value, status => Model.Status = status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string imageSmall;
|
|
|
|
|
public int NbPages
|
|
|
|
|
{
|
|
|
|
|
get => Model.NbPages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private float? userRating;
|
|
|
|
|
public Languages Language
|
|
|
|
|
{
|
|
|
|
|
get => Model.Language;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
public string ImageSmall
|
|
|
|
|
{
|
|
|
|
|
get => Model.ImageSmall;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Properties
|
|
|
|
|
public float? UserRating
|
|
|
|
|
{
|
|
|
|
|
get => Model?.UserRating;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (Model == null) return;
|
|
|
|
|
SetProperty(Model.UserRating, value, rating => Model.UserRating = rating);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -60,7 +88,7 @@ namespace ViewModels
|
|
|
|
|
|
|
|
|
|
public BookVM(Book b)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Model = b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|