public async Task <IActionResult> Edit(int id, EditEmployeViewModel editEmployeViewModel) { if (id != editEmployeViewModel.EmployeId) { return(NotFound()); } if (ModelState.IsValid) { try { Personne personne = new Personne { PersonneId = id, Nom = editEmployeViewModel.Nom, Prenom = editEmployeViewModel.Prenom, Sexe = editEmployeViewModel.Sexe, DateNaissance = editEmployeViewModel.DateNaissance, NumSecu = editEmployeViewModel.NumSecu, Discriminator = "Employe" }; _context.Update(personne); await _context.SaveChangesAsync(); string telephone = phoneRegex.Replace(editEmployeViewModel.Telephone, "($1) $2-$3"); Employe employe = new Employe { EmployeId = id, Personne = personne, Externe = editEmployeViewModel.Externe, Poste = editEmployeViewModel.Poste, Telephone = telephone }; _context.Update(employe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeExists(editEmployeViewModel.EmployeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(editEmployeViewModel)); }
public async Task <IActionResult> Edit(int id, EditParentViewModel editParentViewModel) { if (id != editParentViewModel.ParentId) { return(NotFound()); } if (ModelState.IsValid) { try { Personne personne = new Personne { PersonneId = id, Nom = editParentViewModel.Nom, Prenom = editParentViewModel.Prenom, Sexe = editParentViewModel.Sexe, DateNaissance = editParentViewModel.DateNaissance, NumSecu = editParentViewModel.NumSecu, Discriminator = "Parent" }; _context.Update(personne); await _context.SaveChangesAsync(); Parent parent = new Parent { ParentId = id, Personne = personne, Telephone = editParentViewModel.Telephone, NbEnfantsInscrits = editParentViewModel.NbEnfantsInscrits }; _context.Update(parent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParentExists(editParentViewModel.ParentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(editParentViewModel)); }
public async Task <IActionResult> Edit(int id, [Bind("FichePayeId,SalaireBrut,NbHeuresPrevu,NbHeuresReel,DossierEmployeId,Visible")] FichePaye fichePaye) { if (id != fichePaye.FichePayeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fichePaye); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FichePayeExists(fichePaye.FichePayeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DossierEmployeId"] = new SelectList(_context.DossiersEmploye, "DossierId", "DossierId", fichePaye.DossierEmployeId); return(View(fichePaye)); }
public async Task <IActionResult> Edit(int id, [Bind("InventaireId,Visible")] InventaireEnfant inventaireEnfant) { if (id != inventaireEnfant.InventaireId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventaireEnfant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventaireEnfantExists(inventaireEnfant.InventaireId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inventaireEnfant)); }
public async Task <IActionResult> Edit(int id, [Bind("DossierId,DateInscription,NbDemiJourneesInscrit,NbDemiJourneesAbsent,MedecinTraitant,EnfantId,Visible")] DossierInscription dossierInscription) { if (id != dossierInscription.DossierId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dossierInscription); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DossierInscriptionExists(dossierInscription.DossierId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EnfantId"] = new SelectList(_context.Enfants, "EnfantId", "EnfantId", dossierInscription.EnfantId); return(View(dossierInscription)); }
public async Task <IActionResult> Edit(int id, [Bind("MaladieId,EnfantId,NomMedicament,Specification,Type,Quantite,Frequence,Visible")] Traitement traitement) { if (id != traitement.MaladieId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(traitement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TraitementExists(traitement.MaladieId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EnfantId"] = new SelectList(_context.Enfants, "EnfantId", "EnfantId", traitement.EnfantId); ViewData["MaladieId"] = new SelectList(_context.Maladies, "MaladieId", "MaladieId", traitement.MaladieId); return(View(traitement)); }
public async Task <IActionResult> Edit(int id, [Bind("TypeGroupeId,Libelle")] TypeGroupe typesGroupe) { if (id != typesGroupe.TypeGroupeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(typesGroupe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypesGroupeExists(typesGroupe.TypeGroupeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(typesGroupe)); }
public async Task <IActionResult> Edit(int id, [Bind("Date,ActiviteId,GroupeId,SalleId,Visible")] Participation participation) { if (id != participation.ActiviteId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(participation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParticipationExists(participation.ActiviteId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ActiviteId"] = new SelectList(_context.Activites, "ActiviteId", "ActiviteId", participation.ActiviteId); ViewData["GroupeId"] = new SelectList(_context.Groupes, "GroupeId", "GroupeId", participation.GroupeId); ViewData["SalleId"] = new SelectList(_context.Lieux, "SalleId", "SalleId", participation.SalleId); return(View(participation)); }
public async Task <IActionResult> Edit(int id, [Bind("HoraireId,Date,HeureDebut,HeureFin,CalendrierId,Visible,EmployeId")] Horaire horaire) { if (id != horaire.HoraireId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(horaire); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HoraireExists(horaire.HoraireId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CalendrierId"] = new SelectList(_context.Calendriers, "CalendrierId", "CalendrierId", horaire.CalendrierId); return(View(horaire)); }
public async Task <IActionResult> Edit(int id, [Bind("AdresseId,PersonneId,Domicile,Facturation,Visible")] PersonneAdresse personneAdresse) { if (id != personneAdresse.AdresseId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(personneAdresse); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonneAdresseExists(personneAdresse.AdresseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AdresseId"] = new SelectList(_context.Adresses, "AdresseId", "AdresseId", personneAdresse.AdresseId); ViewData["PersonneId"] = new SelectList(_context.Personnes, "PersonneId", "PersonneId", personneAdresse.PersonneId); return(View(personneAdresse)); }
public async Task <IActionResult> Edit(int id, [Bind("AdresseId,Ligne1,Ligne2,Ligne3,Ville,CodePostal,Pays,Visible")] Adresse adresse) { if (id != adresse.AdresseId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(adresse); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdresseExists(adresse.AdresseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(adresse)); }
public async Task <IActionResult> Edit(int id, [Bind("DocumentId,Nom,Url,DossierId,Visible")] DocumentOfficiel documentOfficiel) { if (id != documentOfficiel.DocumentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(documentOfficiel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocumentOfficielExists(documentOfficiel.DocumentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DossierId"] = new SelectList(_context.DossiersInscription, "DossierId", "DossierId", documentOfficiel.DossierId); return(View(documentOfficiel)); }
public async Task <IActionResult> Edit(int id, [Bind("FactureId,ParentId,Visible")] ParentFacture parentFacture) { if (id != parentFacture.FactureId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(parentFacture); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParentFactureExists(parentFacture.FactureId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FactureId"] = new SelectList(_context.Factures, "FactureId", "FactureId", parentFacture.FactureId); ViewData["ParentId"] = new SelectList(_context.Parents, "ParentId", "ParentId", parentFacture.ParentId); return(View(parentFacture)); }
public async Task <IActionResult> Edit(int id, [Bind("DossierId,DateEntree,NbMoisAnciennete,TauxHoraireBrut,Visible,TypeContratId,EmployeId")] DossierEmploye dossierEmploye) { if (id != dossierEmploye.DossierId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dossierEmploye); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DossierEmployeExists(dossierEmploye.DossierId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeId"] = new SelectList(_context.Employes, "EmployeId", "EmployeId", dossierEmploye.EmployeId); ViewData["TypeContratId"] = new SelectList(_context.TypesContrat, "TypeContratId", "TypeContratId", dossierEmploye.TypeContratId); return(View(dossierEmploye)); }
public async Task <IActionResult> Edit(int id, [Bind("InventaireId,StockMax,StockActuel,EmployeId,Visible")] Inventaire inventaire) { if (id != inventaire.InventaireId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventaire); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventaireExists(inventaire.InventaireId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeId"] = new SelectList(_context.Employes, "EmployeId", "EmployeId", inventaire.EmployeId); return(View(inventaire)); }
public async Task <IActionResult> Edit(int id, [Bind("ContactId,Telephone")] ContactUrgence contactUrgence) { if (id != contactUrgence.ContactId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contactUrgence); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContactUrgenceExists(contactUrgence.ContactId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(contactUrgence)); }
public async Task <IActionResult> Edit(int id, [Bind("FactureId,DateEmission,DatePaiement,MontantTtc,Visible,StatutFactureId")] Facture facture) { if (id != facture.FactureId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(facture); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FactureExists(facture.FactureId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StatutFactureId"] = new SelectList(_context.StatutsFacture, "StatutFactureId", "Libelle", facture.StatutFactureId); return(View(facture)); }
public async Task <IActionResult> Edit(int id, [Bind("ObjetFacturableId,PrixHt,Nom,Tvaid,ActiviteId,Visible")] ObjetFacturable objetFacturable) { if (id != objetFacturable.ObjetFacturableId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(objetFacturable); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ObjetFacturableExists(objetFacturable.ObjetFacturableId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ActiviteId"] = new SelectList(_context.Activites, "ActiviteId", "ActiviteId", objetFacturable.ActiviteId); ViewData["Tvaid"] = new SelectList(_context.Tvas, "Tvaid", "Tvaid", objetFacturable.Tvaid); return(View(objetFacturable)); }
public async Task <IActionResult> Edit(int id, [Bind("ActiviteId,Nom,Description,NbEnfantsMax,Lieu,Visible")] Activite activite) { if (id != activite.ActiviteId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(activite); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActiviteExists(activite.ActiviteId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(activite)); }
public async Task <IActionResult> Edit(int id, [Bind("CategorieId,Nom,Visible")] CategorieArticle categorieArticle) { if (id != categorieArticle.CategorieId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(categorieArticle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategorieArticleExists(categorieArticle.CategorieId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(categorieArticle)); }
public async Task <IActionResult> Edit(int id, [Bind("MaladieId,Nom,Descriptif,Visible")] Maladie maladie) { if (id != maladie.MaladieId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(maladie); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaladieExists(maladie.MaladieId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(maladie)); }
public async Task <IActionResult> Edit(int id, [Bind("LigneId,TotalHt,TotalTtc,Quantite,FactureId,ObjetFacturableId,Visible")] LigneFacture ligneFacture) { if (id != ligneFacture.LigneId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ligneFacture); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LigneFactureExists(ligneFacture.LigneId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ObjetFacturableId"] = new SelectList(_context.ObjetsFacturables, "ObjetFacturableId", "ObjetFacturableId", ligneFacture.ObjetFacturableId); return(View(ligneFacture)); }
public async Task <IActionResult> Edit(int id, [Bind("GroupeId,EmployeId")] EmployeGroupe employeGroupe) { if (id != employeGroupe.GroupeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employeGroupe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeGroupeExists(employeGroupe.GroupeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeId"] = new SelectList(_context.Employes, "EmployeId", "EmployeId", employeGroupe.EmployeId); ViewData["GroupeId"] = new SelectList(_context.Groupes, "GroupeId", "GroupeId", employeGroupe.GroupeId); return(View(employeGroupe)); }
public async Task <IActionResult> Edit(int id, [Bind("ParentId,EnfantId,LienParente,Visible")] Filiation filiation) { if (id != filiation.ParentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(filiation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FiliationExists(filiation.ParentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EnfantId"] = new SelectList(_context.Enfants, "EnfantId", "EnfantId", filiation.EnfantId); ViewData["ParentId"] = new SelectList(_context.Parents, "ParentId", "ParentId", filiation.ParentId); return(View(filiation)); }
public async Task <IActionResult> Edit(int id, [Bind("StatutFactureId,Libelle")] StatutFacture statutFacture) { if (id != statutFacture.StatutFactureId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(statutFacture); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StatutFactureExists(statutFacture.StatutFactureId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(statutFacture)); }
public async Task <IActionResult> Edit(int id, [Bind("SalleId,Libelle,Occupe,Visible")] Lieu lieu) { if (id != lieu.SalleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lieu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LieuExists(lieu.SalleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lieu)); }
public async Task <IActionResult> Edit(int id, [Bind("RapportId,Date,Present,Resume,Visible,DossierInscriptionId")] RapportJournalier rapportJournalier) { if (id != rapportJournalier.RapportId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rapportJournalier); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RapportJournalierExists(rapportJournalier.RapportId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DossierInscriptionId"] = new SelectList(_context.DossiersInscription, "DossierId", "DossierId", rapportJournalier.DossierInscriptionId); return(View(rapportJournalier)); }
public async Task <IActionResult> Edit(int id, [Bind("PersonneId,Nom,Prenom,Sexe,DateNaissance,NumSecu,Visible,Discriminator")] Personne personne) { if (id != personne.PersonneId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(personne); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonneExists(personne.PersonneId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(personne)); }
public async Task <IActionResult> Edit(int id, [Bind("ArticleId,Nom,Quantite,Photo,Visible,Description,InventaireId,EnfantInventaireId,CategorieId")] Article article) { if (id != article.ArticleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(article); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleExists(article.ArticleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategorieId"] = new SelectList(_context.CategoriesArticle, "CategorieId", "CategorieId", article.CategorieId); ViewData["EnfantInventaireId"] = new SelectList(_context.InventairesEnfant, "InventaireId", "InventaireId", article.EnfantInventaireId); ViewData["InventaireId"] = new SelectList(_context.Inventaires, "InventaireId", "InventaireId", article.InventaireId); return(View(article)); }
public async Task <IActionResult> Edit(int id, [Bind("Tvaid,Nom,Valeur,Visible")] Tva tva) { if (id != tva.Tvaid) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tva); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TvaExists(tva.Tvaid)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tva)); }