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();
            }
        }
Esempio n. 2
0
 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");
     }
 }
Esempio n. 3
0
 public void UpdateEtageDetached(Etage e)
 {
     utOfWork.EtageRepository.UpdateEtageDetached(e);
 }
Esempio n. 4
0
        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();
            }
        }
Esempio n. 6
0
 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");
     }
 }
Esempio n. 7
0
 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");
     }
 }