You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LivreLand/ViewModels/BookVM.cs

100 lines
2.2 KiB

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<Book>
{
#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<string> 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<AuthorVM> 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 Languages Language
{
get => Model.Language;
set => SetProperty(Model.Language, value, v => Model.Language = 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
}
}