public ActionResult CreateEtage(Etage etag, FormCollection collection) { int iddelegation = db.FindDelegationByBatiment(etag.idBatiment); IEtageService et = new EtageService(); if (ModelState.IsValid) { try { et.CreateEtage(etag); et.SaveEtage(); return RedirectToAction("GetEtage"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } } else { ViewData["delegation"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["batiment"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description"); return View(); } }
public ActionResult CreateEtage(Etage etag, FormCollection collection) { // int idregion = db.FindRegionByBatiment(etag.idBatiment); // int idgou = db.FindGouverneratByBatiment(etag.idBatiment); // int idpays = db.FindPaysByBatiment(etag.idBatiment); int iddelegation = db.FindDelegationByBatiment(etag.idBatiment); // int idorg = db.FindOrganisationByDelegation(etag.idBatiment); etag.idDelegation = iddelegation; IEtageService et = new EtageService(); try { et.CreateEtage(etag); et.SaveEtage(); return RedirectToAction("GetEtage"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public void UpdateEtageDetached(Etage e) { utOfWork.EtageRepository.UpdateEtageDetached(e); }
public void CreateEtage(Etage Etage) { utOfWork.EtageRepository.Add(Etage); }
public ActionResult EditEtage(Etage etg) { if (ModelState.IsValid) { try { etage.UpdateEtageDetached(etg); etage.SaveEtage(); return RedirectToAction("GetEtage"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } } else { ViewData["pays"] = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle"); ViewData["region"] = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle"); ViewData["gouvernorat"] = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle"); ViewData["organisation"] = new SelectList(BissInventaireEntities.Instance.Organisation.ToList(), "idOrganisation", "libelle"); ViewData["delegation"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["batiment"] = new SelectList(BissInventaireEntities.Instance.Batiment.ToList(), "idBatiment", "description"); return View(); } }
public ActionResult EditEtage(Etage etg) { try { etage.UpdateEtageDetached(etg); etage.SaveEtage(); return RedirectToAction("GetEtage"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public ActionResult CreateEtage(Etage etg) { try { BissInventaireEntities.Instance.Etage.Add(etg); BissInventaireEntities.Instance.SaveChanges(); return RedirectToAction("GetEtage"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }