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.
57 lines
1.2 KiB
57 lines
1.2 KiB
using System;
|
|
using Model;
|
|
using MyToolkitMVVM;
|
|
|
|
namespace ViewModel
|
|
{
|
|
public class BookVM : BaseViewModel<Book>
|
|
{
|
|
public string Title
|
|
{
|
|
get =>Model.Title;
|
|
set =>SetProperty(Model.Title,value,v=>Model.Title=v);
|
|
}
|
|
|
|
public string Image
|
|
{
|
|
get => Model.ImageLarge;
|
|
set { }
|
|
}
|
|
|
|
public Status BookStatus
|
|
{
|
|
get => Model.Status;
|
|
set
|
|
{
|
|
SetProperty(Model.Status, value, v => Model.Status = v);
|
|
}
|
|
}
|
|
|
|
public List<Author> BookAuthors
|
|
{
|
|
get => Model.Authors;
|
|
set
|
|
{
|
|
SetProperty(Model.Authors, value, v => Model.Authors = v);
|
|
}
|
|
}
|
|
|
|
public string BookFirstAuthor { get; private set; }
|
|
|
|
public BookVM(Book book)
|
|
{
|
|
Model = book;
|
|
Title = book.Title;
|
|
BookStatus = book.Status;
|
|
BookAuthors = book.Authors;
|
|
Image = book.ImageLarge;
|
|
if (BookAuthors.Count() > 0)
|
|
{
|
|
BookFirstAuthor = BookAuthors.First().Name;
|
|
}
|
|
else BookFirstAuthor = "Unknow";
|
|
}
|
|
}
|
|
}
|
|
|