public ActionResult Create(auteur a) { if (ModelState.IsValid) { ause.AddAuteur(a); return(RedirectToAction("Index")); } else { return(View()); } }
public int findlastaut() { int numaut = 0; auteur aut = new auteur(); aut = db.auteur.ToList().LastOrDefault(); if (aut == null) { numaut = 1; } else { numaut = (int)aut.numeroaut; } return(numaut); }
public void updateaut(auteur aut) { auteur thisaut = new auteur(); thisaut = db.auteur.Where(aa => aa.numeroaut == aut.numeroaut).FirstOrDefault(); thisaut.nom = aut.nom; thisaut.prenom = aut.prenom; thisaut.adr = aut.adr; thisaut.email = aut.email; thisaut.institution = aut.institution; thisaut.ville = aut.ville; thisaut.web = aut.web; thisaut.specialite = aut.specialite; thisaut.codepostal = aut.codepostal; db.SaveChanges(); }
//Appui sur le bouton ajouter livre private void btn_ajouter_Click(object sender, EventArgs e) { string resu; AuteurProc auteurProc; AuteurProc auteurProc2; LivreProc livreProc; LivreProc unLivreProc2; resu = "Couleur"; if (txtbox_titre.Text != "" && txtbox_codeISBn.Text != "" && txtbox_tome.Text != "" && datepick_annee.Value.ToString("MM/yyyy") != "" && txtbox_nbPg.Text != "" && txtbox_format.Text != "" && cbbx_serie.Text != "" && cbbx_editeur.Text != "") // si tout les champs sont remplis { if (rbtnNoir.Checked == true) //radio bouton pour choisir la colorimétrie { resu = "Noir et Blanc"; } livreProc = new LivreProc(); auteurProc = new AuteurProc(); auteurProc2 = new AuteurProc(); unLivreProc2 = new LivreProc(); unLivreProc2 = new LivreProc(); unLivreProc2 = new LivreProc(); unLivre = new Livre(txtbox_titre.Text, txtbox_codeISBn.Text, txtbox_tome.Text, datepick_annee.Value.ToString("MM/yyyy"), int.Parse(txtbox_nbPg.Text), "", resu, txtbox_commentaire.Text, txtbox_format.Text, unLivreProc.GetNumSerier(cbbx_serie.Text), unLivreProc.GetNumEditeur(cbbx_editeur.Text)); //instancie un nouveeau livre unLivreProc.AjouterLivre(unLivre); // ajoute le livre à la base auteurDessin = new auteur(livreProc.GetId(txtbox_codeISBn.Text), auteurProc.GetNumAuteur(cbbxDessin.Text), 1); //instancie l'auteur du dessin auteurScenario = new auteur(unLivreProc2.GetId(txtbox_codeISBn.Text), auteurProc.GetNumAuteur(cbbxScenario.Text), 0); //instancie k'auteur du scénario //ajoute les auteurs auteurProc2.AjouterAuteurLivre(auteurDessin); auteurProc.AjouterAuteurLivre(auteurScenario); //vide les champs txtbox_codeISBn.Text = ""; txtbox_titre.Text = ""; txtbox_nbPg.Text = ""; cbbx_editeur.Text = ""; cbbx_serie.Text = ""; txtbox_format.Text = ""; txtbox_commentaire.Text = ""; txtbox_tome.Text = ""; newDataGrid(); //actualise le datagrid } else { pnl_MsgErreurGestionLivre.Visible = true; } // sinon affiche le message d'erreur }
private void btnModifierAuteur_Click(object sender, EventArgs e) { if (datePickerDeces.Enabled == false) { _auteur = new AuteurProc(); unAuteur = new auteur(autId, txtBoxNom.Text, txtBoxPrenom.Text, txtBoxPseudo.Text, datePickerNaiss.Value, txtBoxPays.Text, txtBoxBio.Text); _auteur.modificationAuteur(unAuteur); } else { _auteur = new AuteurProc(); unAuteur = new auteur(autId, txtBoxNom.Text, txtBoxPrenom.Text, txtBoxPseudo.Text, datePickerNaiss.Value, datePickerDeces.Value, txtBoxPays.Text, txtBoxBio.Text); _auteur.modificationAuteur(unAuteur); } //Réinitialise les champs après la validation. txtBoxNom.Text = ""; txtBoxPrenom.Text = ""; txtBoxBio.Text = ""; txtBoxPays.Text = ""; txtBoxPseudo.Text = ""; newDataGrid(); }
public void deleteauth(auteur aut) { db.auteur.Remove(aut); db.SaveChanges(); }
public void addauteur(auteur aut) { db.auteur.Add(aut); db.SaveChanges(); }
public void AddAuteur(auteur a) { utwk.AuteurRepository.Add(a); utwk.Commit(); }