public void CreateBatiment(Batiment Batiment) { utOfWork.BatimentRepository.Add(Batiment); }
public ActionResult CreateBatiment(Batiment reg) { try { batiment.CreateBatiment(reg); batiment.SaveBatiment(); return RedirectToAction("GetBatiment"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public ActionResult EditBatiment(Batiment reg) { try { var bat = batiment.FindBatimentByID(reg.idBatiment); //var bat2 = BissInventaireEntities.Instance.Batiment.Find(reg.idBatiment); batiment.UpdateBatimentDetached(reg); batiment.SaveBatiment(); return RedirectToAction("GetBatiment"); } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); } }
public ActionResult CreateBatiment(Batiment reg) { if (ModelState.IsValid) { try { if (etat) { batiment.CreateBatiment(reg); batiment.SaveBatiment(); return RedirectToAction("GetBatiment"); } else { return RedirectToAction("Index", "Error"); } } catch (Exception ex) { LogThread.WriteLine(ex.Message); return RedirectToAction("Index", "Error"); //MsgBox("An exception occurred:"+ ex.Message); } } else { ViewData["gouv"] = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle"); ViewData["region"] = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle"); ViewData["pays"] = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle"); ViewData["delegations"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["organisation"] = new SelectList(BissInventaireEntities.Instance.Organisation.ToList(), "idOrganisation", "libelle"); return View(); } }
public ActionResult EditBatimentTest(Batiment bat) { if (ModelState.IsValid) { //try //{ batiment.UpdateBatimentDetached(bat); batiment.SaveBatiment(); return RedirectToAction("GetBatiment"); // } // catch (Exception ex) // { // LogThread.WriteLine(ex.Message); // return RedirectToAction("Index", "Error"); // } //} } else { ViewData["gouv"] = new SelectList(BissInventaireEntities.Instance.Gouvernorat.ToList(), "idGouvernorat", "libelle"); ViewData["region"] = new SelectList(BissInventaireEntities.Instance.Region.ToList(), "idRegion", "libelle"); ViewData["pays"] = new SelectList(BissInventaireEntities.Instance.Pays.ToList(), "idPays", "libelle"); ViewData["delegations"] = new SelectList(BissInventaireEntities.Instance.Delegation.ToList(), "idDelegation", "libelle"); ViewData["organisation"] = new SelectList(BissInventaireEntities.Instance.Organisation.ToList(), "idOrganisation", "libelle"); return View(); } }
public void UpdateBatimentDetached(Batiment e) { utOfWork.BatimentRepository.UpdateBatimentDetached(e); }