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.
44 lines
1.1 KiB
44 lines
1.1 KiB
using Model;
|
|
using System.Diagnostics;
|
|
using ToolKit;
|
|
|
|
namespace VMWrapper
|
|
{
|
|
[QueryProperty(nameof(BookId), "BookId")]
|
|
public class DetailBookViewModel : BaseViewModel
|
|
{
|
|
private readonly ILibraryManager data;
|
|
|
|
private string _bookId;
|
|
public string BookId
|
|
{
|
|
get { return _bookId; }
|
|
set { SetProperty(ref _bookId, value); }
|
|
}
|
|
|
|
public Book BookDetail { get; private set; } = new Book();
|
|
|
|
public DetailBookViewModel(ILibraryManager data)
|
|
{
|
|
this.data = data;
|
|
LoadBookDetail(BookId);
|
|
}
|
|
|
|
private async void LoadBookDetail(string idBook)
|
|
{
|
|
try
|
|
{
|
|
if (idBook != "")
|
|
{
|
|
BookDetail = await data.GetBookById(idBook);
|
|
OnPropertyChanged(nameof(BookDetail));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Debug.WriteLine(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|