public void TestajouterClient() { Blibliotheque bliblio = new Blibliotheque(); Client client = new Client("Jean", "*****@*****.**"); bliblio.ajouterClient(client); Assert.AreEqual(1, bliblio.ListClients.Count); }
public void TestajouterLivre() { Blibliotheque bliblio = new Blibliotheque(); Auteur jkRowling = new Auteur(1, "JK Rowling"); Livre l1 = new Livre(1, "l'ecole des sorcier", new DateTime(2012, 12, 12), jkRowling); bliblio.ajouterLivre(l1); Assert.AreEqual(1, bliblio.ListLivres.Count); }
//Get:Livres+Auteur public string Index() { Blibliotheque bliblio = Blibliotheque.initialisation(); List <Livre> listLivre = bliblio.ListLivres; string str = ""; foreach (Livre livre in listLivre) { str += "Titre : " + livre.Titre + " Auteur : " + livre.Auteur.Nom + "<br>"; } return(str); }
public string rechercheLivre(string titre) { Blibliotheque bliblio = Blibliotheque.initialisation(); List <Livre> listLivre = bliblio.ListLivres; List <Livre> trouve = new List <Livre>(); foreach (Livre livre in listLivre) { if (livre.Titre.Contains(titre)) { trouve.Add(livre); } } return(trouve.ToString()); }
public string Auteur(int id) { Blibliotheque bliblio = Blibliotheque.initialisation(); List <Livre> listLivre = bliblio.ListLivres; foreach (Livre livre in listLivre) { if (livre.Auteur.Id == id) { return(livre.Auteur.Nom); } } return("Auteur n'existe pas"); }
public void emprunt_livre_reussi() { Blibliotheque bliblio = new Blibliotheque(); Auteur jkRowling = new Auteur(1, "JK Rowling"); Livre l1 = new Livre(1, "l'ecole des sorcier", new DateTime(2012, 12, 12), jkRowling); bliblio.ajouterLivre(l1); Client client = new Client("Jean", "*****@*****.**"); bliblio.ajouterClient(client); bool emprunt = bliblio.emprunterLivre(client, l1); Assert.AreEqual(emprunt, true); // Assert.AreEqual(bliblio.ListEmprunts.Count, 1); }
public string Livre(int id) { Blibliotheque bliblio = Blibliotheque.initialisation(); List <Livre> listLivre = bliblio.ListLivres; List <Emprunt> listEmprunt = bliblio.ListEmprunts; string str = ""; foreach (Livre livre in listLivre) { if (livre.Id == id) { if (bliblio.isEmprunter(livre)) { str = "Emprunt est emprunté"; } return("titre : " + livre.Titre + "<br> date de parution " + livre.DateParution + " " + str); } } return("Le livre n'existe pas"); }
public string Auteurs() { Blibliotheque bliblio = Blibliotheque.initialisation(); List <Livre> listLivre = bliblio.ListLivres; List <Auteur> listAuteurs = new List <Auteur>(); string str = "Auteurs <br>"; foreach (Livre livre in listLivre) { if (!listAuteurs.Contains(livre.Auteur)) { listAuteurs.Add(livre.Auteur); } } foreach (Auteur a in listAuteurs) { str += a.Nom + "<br>"; } return(str); }
// GET: Rechercher public string Livre(string id) { Blibliotheque bliblio = Blibliotheque.initialisation(); List <Livre> listLivre = bliblio.ListLivres; List <Livre> trouve = new List <Livre>(); foreach (Livre livre in listLivre) { if (livre.Titre.Contains(id)) { trouve.Add(livre); } } string str = ""; foreach (Livre livre in trouve) { str += livre.Titre + "<br>"; } return(str); }