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.
PocketBook/Sources/VMWrapper/DetailBookViewModel.cs

43 lines
1.1 KiB

using Model;
using System.Diagnostics;
using ToolKit;
namespace VMWrapper
{
public class DetailBookViewModel : BaseViewModel
{
private readonly ILibraryManager data;
private readonly IUserLibraryManager userLibraryManager;
public Book BookDetail { get; private set; } = new Book();
public DetailBookViewModel(ILibraryManager data, IUserLibraryManager userLibraryManager)
{
this.data = data;
this.userLibraryManager = userLibraryManager;
}
public async Task UpdateColleciton()
{
await userLibraryManager.UpdateBook(BookDetail);
}
public async Task LoadBookDetail(string idBook)
{
try
{
if (idBook != "")
{
BookDetail = await data.GetBookById(idBook);
OnPropertyChanged(nameof(BookDetail));
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
}
}