public JsonResult update(PersonModel PPP) { Partie ppp = db.Partie.First(t => t.Id == PPP.Id); ppp.Nom = PPP.Nom; ppp.Prenom = PPP.Prenom; ppp.DateNaissance = (DateTime)Convert.ToDateTime(PPP.DateNaissance); ppp.LieuNaissance = PPP.LieuNaissance; ppp.GenreId = PPP.GenreId; ppp.Cin = PPP.Cin; ppp.NationaliteId = (int)Convert.ToInt64(PPP.NationaliteId); ppp.Adresse = PPP.Adresse; ppp.VilleId = (int)Convert.ToInt64(PPP.VilleId); ppp.MetierId = PPP.MetierId; db.SaveChanges(); Obtention pp = db.Obtention.First(u => u.PartieId == PPP.Id); pp.SpecialiteId = PPP.SpecialiteId; pp.CategorieId = PPP.CategorieId; pp.Annee = (DateTime)Convert.ToDateTime(PPP.Annee); db.SaveChanges(); CoordonneesProfessionnelles p = db.CoordonneesProfessionnelles.First(c => c.PartieId == PPP.Id); p.BarreauId = (int)Convert.ToInt64(PPP.BarreauId); p.ReferenceNational = PPP.ReferenceNat; p.OrganeId = (int)Convert.ToInt64(PPP.OrganId); p.SituationPId = (int)Convert.ToInt64(PPP.SituationPId); p.AnneeDA = (DateTime)Convert.ToDateTime(PPP.AnneeDA); p.AnneeAY = (DateTime)Convert.ToDateTime(PPP.AnneeAY); p.CourCassationId = (int)Convert.ToInt64(PPP.CourCassationId); p.AnneeACC = (DateTime)Convert.ToDateTime(PPP.AnneeACC); p.StatutAHId = (int)Convert.ToInt64(PPP.StatutAHId); p.AnneeSt = (DateTime)Convert.ToDateTime(PPP.AnneeSt); p.AnneeRSt = (DateTime)Convert.ToDateTime(PPP.AnneeRSt); p.StatutCapitaineId = (int)Convert.ToInt64(PPP.StatutCapitaineId); p.AnneeCapitaine = (DateTime)Convert.ToDateTime(PPP.AnneeCapitaine); p.AnneeFinSt = (DateTime)Convert.ToDateTime(PPP.AnneeFinSt); p.AvocatAssistantId = (int)Convert.ToInt64(PPP.AvocatAssistantId); p.AvocatParId = (int)Convert.ToInt64(PPP.AvocatParId); p.AvocatCohId = (int)Convert.ToInt64(PPP.AvocatCohId); p.AssuranceId = (int)Convert.ToInt64(PPP.AssuranceId); p.NomAvocatAss = (int)Convert.ToInt64(PPP.NomAvocatAss); p.NomAvocatPar = (int)Convert.ToInt64(PPP.NomAvocatPar); p.NomAvocatCoh = (int)Convert.ToInt64(PPP.NomAvocatCoh); p.NomAvocatAssurance = (int)Convert.ToInt64(PPP.NomAvocatAssurance); p.NomSociete = PPP.NomSociete; db.SaveChanges(); Stage pppp = db.Stage.First(s => s.PartieId == PPP.Id); pppp.AnneeDebut = (DateTime)Convert.ToDateTime(PPP.AnneeDebut); pppp.AnneeArret = (DateTime)Convert.ToDateTime(PPP.AnneeArret); pppp.AnneeReprendre = (DateTime)Convert.ToDateTime(PPP.AnneeReprendre); pppp.AnneFin = (DateTime)Convert.ToDateTime(PPP.AnneeFin); pppp.AnneeSupp = (DateTime)Convert.ToDateTime(PPP.AnneeSupp); pppp.AvocatStageId = (int)Convert.ToInt64(PPP.AvocatStage); db.SaveChanges(); AvocatMembre ppppp = db.AvocatMembre.First(a => a.PartieId == PPP.Id); ppppp.NominationId = (int)Convert.ToInt64(PPP.NominationId); ppppp.AnneeMembre = (DateTime)Convert.ToDateTime(PPP.AnneeMembre); db.SaveChanges(); Audience ppppppp = db.Audience.First(au => au.PartieId == PPP.Id); ppppppp.AnneeAudience = (DateTime)Convert.ToDateTime(PPP.AnneeAudience); ppppppp.DecisionId = (int)Convert.ToInt64(PPP.DecisionId); db.SaveChanges(); Jugement pppppppp = db.Jugement.First(j => j.PartieId == PPP.Id); pppppppp.Jugementt = PPP.Jugement; pppppppp.DateJugement = (DateTime)Convert.ToDateTime(PPP.DateJugement); db.SaveChanges(); Sanction ppppppppp = db.Sanction.First(sa => sa.PartieId == PPP.Id); ppppppppp.SanctionId = (int)Convert.ToInt64(PPP.SanctionId); ppppppppp.DateSanction = (DateTime)Convert.ToDateTime(PPP.DateSanction); db.SaveChanges(); PoursuiteJuridique pppppp = db.PoursuiteJuridique.First(P => P.PartieId == PPP.Id); pppppp.NumeroPole = (int)Convert.ToInt64(PPP.NumeroPole); pppppp.JuridictionId = (int)Convert.ToInt64(PPP.JuridictionId); pppppp.NumeroDossier = (int)Convert.ToInt64(PPP.NumeroDossier); pppppp.Accusation = PPP.Accusation; pppppp.ChaitreSuivi = PPP.ChapitreSuivi; db.SaveChanges(); return(Json("succes")); }
public JsonResult AddP(PersonModel PP) { Partie p = new Partie(); p.Nom = PP.Nom; p.Prenom = PP.Prenom; p.DateNaissance = (DateTime)Convert.ToDateTime(PP.DateNaissance); p.LieuNaissance = PP.LieuNaissance; p.GenreId = PP.GenreId; p.Cin = PP.Cin; p.NationaliteId = (int)Convert.ToInt64(PP.NationaliteId); p.Adresse = PP.Adresse; p.VilleId = (int)Convert.ToInt64(PP.VilleId); p.MetierId = (int)Convert.ToInt64(PP.MetierId); db.Partie.Add(p); db.SaveChanges(); long latest = p.Id; Obtention pp = new Obtention(); pp.PartieId = latest; pp.CategorieId = PP.CategorieId; pp.SpecialiteId = PP.SpecialiteId; pp.Annee = (DateTime)Convert.ToDateTime(PP.Annee); db.Obtention.Add(pp); db.SaveChanges(); CoordonneesProfessionnelles ppp = new CoordonneesProfessionnelles(); ppp.PartieId = latest; ppp.BarreauId = (int)Convert.ToInt64(PP.BarreauId); ppp.ReferenceNational = PP.ReferenceNat; ppp.OrganeId = (int)Convert.ToInt64(PP.OrganId); ppp.SituationPId = (int)Convert.ToInt64(PP.SituationPId); ppp.AnneeDA = (DateTime)Convert.ToDateTime(PP.AnneeDA); ppp.AnneeAY = (DateTime)Convert.ToDateTime(PP.AnneeAY); ppp.CourCassationId = (int)Convert.ToInt64(PP.CourCassationId); ppp.AnneeACC = (DateTime)Convert.ToDateTime(PP.AnneeACC); ppp.StatutAHId = (int)Convert.ToInt64(PP.StatutAHId); ppp.AnneeSt = (DateTime)Convert.ToDateTime(PP.AnneeSt); ppp.AnneeRSt = (DateTime)Convert.ToDateTime(PP.AnneeRSt); ppp.StatutCapitaineId = (int)Convert.ToInt64(PP.StatutCapitaineId); ppp.AnneeCapitaine = (DateTime)Convert.ToDateTime(PP.AnneeCapitaine); ppp.AnneeFinSt = (DateTime)Convert.ToDateTime(PP.AnneeFinSt); ppp.AvocatAssistantId = (int)Convert.ToInt64(PP.AvocatAssistantId); ppp.AvocatParId = (int)Convert.ToInt64(PP.AvocatParId); ppp.AvocatCohId = (int)Convert.ToInt64(PP.AvocatCohId); ppp.AssuranceId = (int)Convert.ToInt64(PP.AssuranceId); ppp.NomSociete = PP.NomSociete; ppp.NomAvocatAss = PP.NomAvocatAss; ppp.NomAvocatPar = PP.NomAvocatPar; ppp.NomAvocatCoh = PP.NomAvocatCoh; ppp.NomAvocatAssurance = PP.NomAvocatAssurance; db.CoordonneesProfessionnelles.Add(ppp); db.SaveChanges(); Stage pppp = new Stage(); pppp.PartieId = latest; pppp.AnneeDebut = (DateTime)Convert.ToDateTime(PP.AnneeDebut); pppp.AnneeArret = (DateTime)Convert.ToDateTime(PP.AnneeArret); pppp.AnneeReprendre = (DateTime)Convert.ToDateTime(PP.AnneeReprendre); pppp.AnneFin = (DateTime)Convert.ToDateTime(PP.AnneeFin); pppp.AnneeSupp = (DateTime)Convert.ToDateTime(PP.AnneeSupp); pppp.AvocatStageId = (int)Convert.ToInt64(PP.AvocatStage); db.Stage.Add(pppp); db.SaveChanges(); AvocatMembre ppppppppp = new AvocatMembre(); ppppppppp.PartieId = latest; ppppppppp.NominationId = (int)Convert.ToInt64(PP.NominationId); ppppppppp.AnneeMembre = (DateTime)Convert.ToDateTime(PP.AnneeMembre); db.AvocatMembre.Add(ppppppppp); db.SaveChanges(); Audience pppppp = new Audience(); pppppp.PartieId = latest; pppppp.AnneeAudience = (DateTime)Convert.ToDateTime(PP.AnneeAudience); pppppp.DecisionId = (int)Convert.ToInt64(PP.DecisionId); db.Audience.Add(pppppp); db.SaveChanges(); Jugement ppppppp = new Jugement(); ppppppp.PartieId = latest; ppppppp.Jugementt = PP.Jugement; ppppppp.DateJugement = (DateTime)Convert.ToDateTime(PP.DateJugement); db.Jugement.Add(ppppppp); db.SaveChanges(); Sanction pppppppp = new Sanction(); pppppppp.PartieId = latest; pppppppp.SanctionId = (int)Convert.ToInt64(PP.SanctionId); pppppppp.DateSanction = (DateTime)Convert.ToDateTime(PP.DateSanction); db.Sanction.Add(pppppppp); db.SaveChanges(); PoursuiteJuridique ppppp = new PoursuiteJuridique(); ppppp.PartieId = latest; ppppp.NumeroPole = PP.NumeroPole; ppppp.JuridictionId = (int)Convert.ToInt64(PP.JuridictionId); ppppp.NumeroDossier = PP.NumeroDossier; ppppp.Accusation = PP.Accusation; ppppp.ChaitreSuivi = PP.ChapitreSuivi; db.PoursuiteJuridique.Add(ppppp); db.SaveChanges(); return(Json("succes")); }