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.

199 lines
5.7 KiB

using BookApp.Model;
using System.Collections.ObjectModel;
namespace BookApp.Data
{
public class Stub
{
public ObservableCollection<Auteur> Auteurs { get; private set; } =
new ObservableCollection<Auteur>();
public ObservableCollection<Auteur> CreateStubData()
{
var victorHugo = new Auteur
{
Name = "Victor Hugo",
Books = new ObservableCollection<Book>()
};
var georgeOrwell = new Auteur
{
Name = "George Orwell",
Books = new ObservableCollection<Book>()
};
var jkRowling = new Auteur
{
Name = "J.K. Rowling",
Books = new ObservableCollection<Book>()
};
Auteurs.Add(victorHugo);
Auteurs.Add(georgeOrwell);
Auteurs.Add(jkRowling);
AddBookToAuthor(
victorHugo,
"Les Misérables",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Grasset",
"Une épopée sur la vie de Jean Valjean...",
1232,
"Français",
"978-1234567890",
"2023-09-10",
"https://link_to_les_miserables.com"
);
AddBookToAuthor(
victorHugo,
"Notre-Dame de Paris",
"dotnet_bot.svg",
new Star(4),
StatutDeLecture.A_Lire,
false,
true,
false,
"Grasset",
"L'histoire de Quasimodo...",
940,
"Français",
"978-2345678910",
"2023-06-05",
"https://link_to_notre_dame.com"
);
AddBookToAuthor(
georgeOrwell,
"1984",
"dotnet_bot.svg",
new Star(4),
StatutDeLecture.A_Lire,
false,
true,
false,
"Penguin",
"L'histoire d'un futur dystopique...",
328,
"Anglais",
"978-9876543210",
"2023-08-01",
"https://link_to_1984.com"
);
AddBookToAuthor(
georgeOrwell,
"La Ferme des animaux",
"dotnet_bot.svg",
new Star(3),
StatutDeLecture.Non_Lu,
false,
false,
true,
"Penguin",
"Comment les animaux ont pris le pouvoir...",
112,
"Anglais",
"978-8765432109",
"2023-07-20",
"https://link_to_ferme_animaux.com"
);
AddBookToAuthor(
jkRowling,
"Harry Potter à l'école des sorciers",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Bloomsbury",
"L'aventure magique commence pour Harry...",
309,
"Anglais",
"978-7654321098",
"2023-01-15",
"https://link_to_hp_sorciers.com"
);
AddBookToAuthor(
jkRowling,
"Harry Potter et la chambre des secrets",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Bloomsbury",
"Le mystère de la Chambre des Secrets...",
341,
"Anglais",
"978-6543210987",
"2023-02-10",
"https://link_to_hp_chambre.com"
);
AddBookToAuthor(
jkRowling,
"Harry Potter et le prisonnier d'Azkaban",
"dotnet_bot.svg",
new Star(5),
StatutDeLecture.Lu,
true,
false,
false,
"Bloomsbury",
"Le danger rôde autour d'Harry...",
435,
"Anglais",
"978-5432109876",
"2023-03-05",
"https://link_to_hp_azkaban.com"
);
return Auteurs;
}
private void AddBookToAuthor(
Auteur author,
string name,
string imageBook,
Star note,
StatutDeLecture statut,
bool favori,
bool next,
bool pret,
string maisonEdit,
string resumer,
int nbPage,
string langue,
string isbn,
string dateAjout,
string link
)
{
author.Books.Add(
new Book
{
Name = name,
ImageBook = imageBook,
Auteur = author,
Note = note,
Statut = statut,
Favori = favori,
Next = next,
Pret = pret,
MaisonEdit = maisonEdit,
Resumer = resumer,
NbPage = nbPage,
Langue = langue,
ISBN = isbn,
dateAjout = dateAjout,
Link = link
}
);
}
}
}