using Model; using System.Collections.ObjectModel; using VMWrapper; using static System.Runtime.InteropServices.JavaScript.JSType; namespace BookApp.ViewModel; public class TousViewModel { BookViewModel _viewModel; public ObservableCollection Authors { get; set; } = new ObservableCollection(); /* public ObservableCollection AuteurGroups { get; private set; } = new ObservableCollection();*/ public TousViewModel(BookViewModel viewModel) { _viewModel = viewModel; GetAuthors(); /* ObservableCollection auteurs = new Stub().CreateStubData(); foreach (Auteur auteur in auteurs) { AuteurGroups.Add(new AuteurGroup(auteur.Name, auteur.Books)); }*/ } //fireandforget public async void GetAuthors() { var authors1 = await _viewModel.GetAuthor(); Authors.Clear(); foreach (var author in authors1) { Authors.Add(author); } } } /*public class AuteurGroup : ObservableCollection { public string Name { get; private set; } public AuteurGroup(string name, ObservableCollection books) : base(books) { Name = name; } }*/