Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo 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"));
            }
        }