public void SaveUpdateRelationFormAdress(RelationFormAdress relation) { using (VeoliaContext db = new VeoliaContext()) { db.Entry(relation).State = EntityState.Modified; db.SaveChanges(); } }
public static void addRelationAdressForm(int formID, int adressID) { OperationRelationAdressForm newTransaction = new OperationRelationAdressForm(); RelationFormAdress newRelation = new RelationFormAdress(); newRelation.adressClientID = adressID; newRelation.formControlConformID = formID; newTransaction.SaveNewRelationFormAdress(newRelation); }
public void DeleteRelationFormAdress(int relationID) { using (VeoliaContext db = new VeoliaContext()) { RelationFormAdress Relation = db.RelationFormAdresss.Find(relationID); db.Entry(Relation).State = EntityState.Deleted; db.SaveChanges(); } }
public int SaveNewRelationFormAdress(RelationFormAdress relation) { using (VeoliaContext db = new VeoliaContext()) { RelationFormAdress Relation = db.RelationFormAdresss.Add(relation); db.SaveChanges(); return(Relation.relationFormAdressID); } }
public ActionResult Create([Bind(Include = "clientID,userId,clientName,clientSurame,clientEmail,clientNumTel,clientDateCreation,clintDateModification,adress")] Client client) { if (ModelState.IsValid) { //Création Client client.clientDateCreation = DateTime.Now; Client addedclient = db.Clients.Add(client); //Création formulaire FormControlConform form = new FormControlConform(); form.clientID = client.clientID; form.userID = client.userId; FormControlConform addedform = db.FormControlConforms.Add(form); //Création Première relation RelationFormAdress relation = new RelationFormAdress(); relation.adress = addedclient.adress[0]; RelationFormAdress addedrelation = db.RelationFormAdresss.Add(relation); if (true) { } //Création deuxième relation Facture RelationFormAdress relationfact = new RelationFormAdress(); relationfact.adress = addedclient.adress[1]; relationfact.adressFacture = true; //Création de recommandation RelationFormAdress addedrelationfact = db.RelationFormAdresss.Add(relationfact); Recommandation recom = new Recommandation(); db.Recommandations.Add(recom); //save data db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.userId = new SelectList(db.Users, "userID", "email", client.userId); return(View(client)); }
public int PostRelationFormAdress(RelationFormAdress relationFormAdress) { return(_repo.SaveNewRelationFormAdress(relationFormAdress)); }
public void PutRelationFormAdress(int id, RelationFormAdress relationFormAdress) { _repo.SaveUpdateRelationFormAdress(relationFormAdress); }