public void Update(CategorieDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { CategorieDeProjet Modifie = new CategorieDeProjet(); CategorieDeProjet AUpdate = Context.CategorieDeProjet.Find(Entity.Id); foreach (PropertyInfo item in AUpdate.GetType().GetProperties()) { var EntityValue = Entity.GetType().GetProperty(item.Name).GetValue(Entity); if (item.GetValue(AUpdate) != EntityValue) { Modifie.GetType().GetProperty(item.Name).SetValue(Modifie, EntityValue); } else { Modifie.GetType().GetProperty(item.Name).SetValue(Modifie, item.GetValue(AUpdate)); } } Context.Entry(AUpdate).CurrentValues.SetValues(Modifie); Context.SaveChanges(); } } else { throw new ArgumentException("La méthode update a échoué"); } }
public void Update(Utilisateur Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Utilisateur Modifie = new Utilisateur(); Utilisateur AUpdate = Context.Utilisateur.Find(Entity.Id); foreach (PropertyInfo item in AUpdate.GetType().GetProperties()) { var EntityValue = Entity.GetType().GetProperty(item.Name).GetValue(Entity); if (item.GetValue(AUpdate) != EntityValue) { Modifie.GetType().GetProperty(item.Name).SetValue(Modifie, EntityValue); } else { Modifie.GetType().GetProperty(item.Name).SetValue(Modifie, item.GetValue(AUpdate)); } } Context.Entry(AUpdate).CurrentValues.SetValues(Modifie); Context.SaveChanges(); } } else { throw new ArgumentException("L'api a eu un problème"); } }
public void delete() { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.NewsLetter.RemoveRange(Context.NewsLetter.ToList()); Context.SaveChanges(); } }
public void delete(CategorieDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.CategorieDeProjet.Remove(Entity); Context.SaveChanges(); } } else { throw new ArgumentException("La méthode delete n'a pas fonctionné"); } }
public void insert(NewsLetter Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.NewsLetter.Add(Entity); Context.SaveChanges(); } } else { throw new ArgumentException("La méthode Inser n'a pas fonctionné"); } }
public void Insert(Utilisateur Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.PSNouveauUtilisateur(Entity.Nom, Entity.Prenom, Entity.Pseudo, Entity.DateDeNaissance, Entity.Email, Entity.Password, Entity.Pays, Entity.Compte_bancaire, Entity.Ad_Rue, Entity.Ad_Ville, Entity.Ad_Code_Post, Entity.Ad_Numero, Entity.NewsLetter, Entity.SecretKey); Context.SaveChanges(); } } else { throw new ArgumentException("L'api Insert à eu un problème"); } }
public void delete(Utilisateur Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.PSDeleteAuteur(Entity.Id); Context.SaveChanges(); } } else { throw new ArgumentException("La suppression à échoué"); } }
public CategorieDeProjet Insert(CategorieDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.CategorieDeProjet.Add(Entity); Context.SaveChanges(); return(Context.CategorieDeProjet.LastOrDefault()); } } else { throw new ArgumentNullException("Le projet n'a pas été enregistré"); } }
public void Delete(Projet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Projet Proj = Context.Projet.Find(Entity.Id); Context.PSPassageProjetHisto(Proj.Id); Context.SaveChanges(); } } else { throw new ArgumentException("La méthode delete n'a pas pu fonctionné"); } }
public void Delete(Utilisateur Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Utilisateur Utili = Context.Utilisateur.Find(Entity.Id); Context.Utilisateur.Remove(Utili); Context.SaveChanges(); } } else { throw new ArgumentException("L'api delete n'a pas fonctionné"); } }