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/ManagerVM.cs

48 lines
1.0 KiB

using Model;
using System.Collections.ObjectModel;
using System.Windows.Input;
namespace ViewModels
{
public class ManagerVM
{
#region Fields
private Manager model;
#endregion
#region Properties
public Manager Model
{
get => model;
private set => model = value;
}
public IEnumerable<BookVM> AllBooks { get; private set; } = new ObservableCollection<BookVM>();
public string SearchTitle { get; private set; }
public int Index { get; private set; }
public int Count { get; private set; }
public int NbPages { get; private set; }
public ICommand GetBooksByTitleCommand { get; }
#endregion
#region Constructor
public ManagerVM(Manager model)
{
Model = model;
GetBooksByTitleCommand = new Command(() => AllBooks = model.GetBooksByTitle(SearchTitle, Index, Count).Result.books.Select(book => new BookVM(book)));
}
#endregion
}
}