public void Update(TypeDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { TypeDeProjet Modifie = new TypeDeProjet(); TypeDeProjet AUpdate = Context.TypeDeProjet.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 n'a pas fonctionné"); } }
public IEnumerable <Auteur> ListeAuteurByType(TypeDeProjet Entity) { List <Auteur> Selection = new List <Auteur>(); foreach (Gl.VAll_Auteur item in Sa.ListeAuteurByType(Mappers <TypeDeProjet, Gl.TypeDeProjet> .VueToEntities(Entity))) { Selection.Add(Mappers <Gl.VAll_Auteur, Auteur> .VueToEntities(item)); } return(Selection); }
public IEnumerable <VProjet> GetAllByType(TypeDeProjet Entity) { List <VProjet> Selection = new List <VProjet>(); foreach (Gl.VAll_Projet item in Sp.GetAllByType(Mappers <TypeDeProjet, Gl.TypeDeProjet> .VueToEntities(Entity))) { Selection.Add(Mappers <Gl.VAll_Projet, VProjet> .VueToEntities(item)); } return(Selection); }
public TypeDeProjet GetOne(TypeDeProjet Entity) { G.TypeDeProjet MonTypeDeProjet = JsonRequest.RecuperationUneInfo <G.TypeDeProjet>("api/tprojet/getone", Mappers <TypeDeProjet, G.TypeDeProjet> .AutoMapper(Entity)); if (MonTypeDeProjet != null) { return(Mappers <G.TypeDeProjet, TypeDeProjet> .AutoMapper(MonTypeDeProjet)); } else { throw new ArgumentException("Méthode Json n'a pas fonctionné"); } }
public string Update(TypeDeProjet Entity) { string Requete = JsonRequest.UpdateMethode <G.TypeDeProjet>("api/tprojet/update", Mappers <TypeDeProjet, G.TypeDeProjet> .AutoMapper(Entity)); if (Requete != null) { return(Requete); } else { throw new ArgumentException("La méthode Json n'a pas réussi"); } }
public string Delete(TypeDeProjet Entity) { string Coucou = JsonRequest.DeleteMethode <G.TypeDeProjet>("api/tprojet/delete", Mappers <TypeDeProjet, G.TypeDeProjet> .AutoMapper(Entity)); if (Coucou != null) { return("L'objet a été delete"); } else { throw new ArgumentException("Ca n'a pas foncionner"); } }
public TypeDeProjet Insert(TypeDeProjet Entity) { if (Entity != null) { G.TypeDeProjet MyPro = JsonRequest.PostMethode <G.TypeDeProjet>("api/tprojet/insert", Mappers <TypeDeProjet, G.TypeDeProjet> .AutoMapper(Entity), "api/tprojet/getall"); return(Mappers <G.TypeDeProjet, TypeDeProjet> .AutoMapper(MyPro)); } else { throw new ArgumentException("L'entity était null"); } }
public TypeDeProjet GetOne(TypeDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { return(Context.TypeDeProjet.Find(Entity.Id)); } } else { throw new ArgumentException("Il n'y a pas de type de ce projet"); } }
public void delete(TypeDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.TypeDeProjet.Remove(Entity); Context.SaveChanges(); } } else { throw new ArgumentException("La méthode delete n'a pas fonctionné"); } }
public TypeDeProjet Insert(TypeDeProjet Entity) { if (Entity != null) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { Context.TypeDeProjet.Add(Entity); Context.SaveChanges(); return(Context.TypeDeProjet.LastOrDefault()); } } else { throw new ArgumentNullException("Le projet n'a pas été enregistré"); } }
public IEnumerable <VAll_Projet> GetAllByType(TypeDeProjet Entity) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { List <VAll_Projet> Selection = new List <VAll_Projet>(); foreach (PSListeProjetByType_Result item in Context.PSListeProjetByType(Entity.Id).ToList()) { Selection.Add(Mappers <PSListeProjetByType_Result, VAll_Projet> .StoredProcedureToVue(item)); } if (Selection.First() != null) { return(Selection); } else { throw new ArgumentOutOfRangeException("La variable selection ne contient aucun projet"); } } }
public IEnumerable <VAll_Auteur> ListeAuteurByType(TypeDeProjet Entity) { using (Crownfunding_EditionEntities Context = new Crownfunding_EditionEntities()) { List <VAll_Auteur> Selection = new List <VAll_Auteur>(); foreach (PSListAuteurByType_Result item in Context.PSListAuteurByType(Entity.Id).ToList()) { Selection.Add(Mappers <PSListAuteurByType_Result, VAll_Auteur> .StoredProcedureToVue(item)); } if (Selection.First() != null) { return(Selection); } else { throw new ArgumentException("Il n'y a pas d'auteur dans cette catégorie"); } } }
public void delete(TypeDeProjet Entity) { Stp.delete(Mappers <TypeDeProjet, Gl.TypeDeProjet> .VueToEntities(Entity)); }
public TypeDeProjet Insert(TypeDeProjet Entity) { Gl.TypeDeProjet Intermediaire = Stp.Insert(Mappers <TypeDeProjet, Gl.TypeDeProjet> .VueToEntities(Entity)); return(Mappers <Gl.TypeDeProjet, TypeDeProjet> .VueToEntities(Intermediaire)); }
public TypeDeProjet GetOne(TypeDeProjet Entity) { Gl.TypeDeProjet GlTp = Mappers <TypeDeProjet, Gl.TypeDeProjet> .StoredProcedureToVue(Entity); return(Mappers <Gl.TypeDeProjet, TypeDeProjet> .VueToEntities(Stp.GetOne(GlTp))); }