using Model; using PersonalMVVMToolkit; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ViewModels { public class BookVM : BaseViewModel { #region Fields #endregion #region Properties public string Id { get => Model.Id; set => SetProperty(Model.Id, value, v => Model.Id = value); } public string ISBN13 { get => Model.ISBN13; set => SetProperty(Model.ISBN13, value, v => Model.ISBN13 = value); } public string Title { get => Model.Title; set => SetProperty(Model.Title, value, v => Model.Title = value); } public List Publishers { get => Model.Publishers; set => SetProperty(Model.Publishers, value, v => Model.Publishers = value); } public DateTime PublishDate { get => Model.PublishDate; set => SetProperty(Model.PublishDate, value, v => Model.PublishDate = value); } public List Authors { get => Model.Authors.Select(a => new AuthorVM(a)).ToList(); } public Status Status { get => Model.Status; set => SetProperty(Model.Status, value, v => Model.Status = value); } public int NbPages { get => Model.NbPages; set => SetProperty(Model.NbPages, value, v => Model.NbPages = value); } public string ImageSmall { get => Model.ImageSmall; } public float? UserRating { get => Model?.UserRating; set { if (Model == null) return; SetProperty(Model.UserRating, value, rating => Model.UserRating = rating); } } #endregion #region Constructor public BookVM(Book b) : base(b) { } #endregion } }