// GET: FormControlConforms/DetailsUsingClient/5 public ActionResult DetailsUsingClient(int?id) { List <AdressClient> addresses = new List <AdressClient>(); var formControlConforms = db.FormControlConforms.Include(f => f.client).Include(f => f.user).Include(s => s.relationFormAdress).ToList(); foreach (FormControlConform form in formControlConforms) { foreach (RelationFormAdress relation in form.relationFormAdress) { addresses = db.AdressClients.Where(s => s.adressClientID == relation.adressClientID).ToList(); } } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var formu = db.FormControlConforms.Where(n => n.clientID == id).ToList(); int a = formu.FirstOrDefault().formControlConformID; FormControlConform formControlConform = db.FormControlConforms.Find(a); if (formControlConform == null) { return(HttpNotFound()); } return(View(formControlConform)); }
public void SaveUpdateFormControlConform(FormControlConform formul) { using (VeoliaContext db = new VeoliaContext()) { db.Entry(formul).State = EntityState.Modified; db.SaveChanges(); } }
public ActionResult DeleteConfirmed(int id) { FormControlConform formControlConform = db.FormControlConforms.Find(id); db.FormControlConforms.Remove(formControlConform); db.SaveChanges(); return(RedirectToAction("Index")); }
public static int addFormcontrol(int ClientID, int userID) { OperationFormContolConform newTransaction = new OperationFormContolConform(); FormControlConform newForm = new FormControlConform(); newForm.clientID = ClientID; newForm.userID = 3; return(newTransaction.SaveNewFormControlConform(newForm)); }
public void DeleteFormulControlConform(int ID) { using (VeoliaContext db = new VeoliaContext()) { FormControlConform formul = db.FormControlConforms.Find(ID); db.Entry(formul).State = EntityState.Deleted; db.SaveChanges(); } }
public int SaveNewFormControlConform(FormControlConform formul) { using (VeoliaContext db = new VeoliaContext()) { FormControlConform NewForm = db.FormControlConforms.Add(formul); db.SaveChanges(); return(NewForm.formControlConformID); } }
public ActionResult Edit([Bind(Include = "formControlConformID,clientID,userID,presenceRegardEU,regardEUAccessible,presenceRegardEP,regardEPAccessible,natureEffluent,typeBranchement,dispositifAntiReflux,wc,salleDeBain,evier,laveLinge,laveVaisselle,systemeRelevage,fosseSeptique,nombreGouttieres,regardPiedGouttiere,evacuationEauPluies,dateControle,constatEnquete,anomaliesConstatees,recommendationTraveauxMiseConformite")] FormControlConform formControlConform) { if (ModelState.IsValid) { db.Entry(formControlConform).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { id = formControlConform.formControlConformID })); } ViewBag.clientID = new SelectList(db.Clients, "clientID", "clientName", formControlConform.clientID); ViewBag.userID = new SelectList(db.Users, "userID", "email", formControlConform.userID); return(View(formControlConform)); }
// GET: FormControlConforms/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FormControlConform formControlConform = db.FormControlConforms.Find(id); if (formControlConform == null) { return(HttpNotFound()); } return(View(formControlConform)); }
// GET: FormControlConforms/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FormControlConform formControlConform = db.FormControlConforms.Find(id); if (formControlConform == null) { return(HttpNotFound()); } ViewBag.clientID = new SelectList(db.Clients, "clientID", "clientName", formControlConform.clientID); ViewBag.userID = new SelectList(db.Users, "userID", "email", formControlConform.userID); ViewBag.adressID = new SelectList(db.AdressClients, "clientID", "adress", formControlConform.clientID); ViewBag.adressID = new SelectList(db.RelationFormAdresss, "clientID", "adress", formControlConform.clientID); return(View(formControlConform)); }
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)); }
// GET: FormControlConforms/Details/5 public ActionResult Details(int?id) { List <AdressClient> addresses = new List <AdressClient>(); List <FormControlConform> formControlConforms = db.FormControlConforms.Include(f => f.client).Include(f => f.user).Include(s => s.relationFormAdress).ToList(); foreach (FormControlConform form in formControlConforms) { foreach (RelationFormAdress relation in form.relationFormAdress) { addresses = db.AdressClients.Where(s => s.adressClientID == relation.adressClientID).ToList(); } } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FormControlConform formControlConform = db.FormControlConforms.Find(id); if (formControlConform == null) { return(HttpNotFound()); } return(View(formControlConform)); }
public int PostFormControlConform(FormControlConform formControlConform) { return(_repo.SaveNewFormControlConform(formControlConform)); }
public void PutFormControlConform(FormControlConform formControlConform) { _repo.SaveUpdateFormControlConform(formControlConform); }