예제 #1
0
        public void CreateDelegation(Delegation Delegation)
        {

            utOfWork.DelegationRepository.Add(Delegation);


        }
 public void UpdateDelegationDetached(Delegation e)
 {
     utOfWork.DelegationRepository.UpdateDelegationDetached(e);
 }
        public ActionResult CreateDelegation(Delegation deleg)
        {
            if (ModelState.IsValid)
            {

                try
                {
                    if (etat)
                    {
                        BissInventaireEntities.Instance.Delegation.Add(deleg);
                        BissInventaireEntities.Instance.SaveChanges();
                        return RedirectToAction("GetDelegation");
                    }
                    else
                    {
                        return RedirectToAction("Index", "Error");
                    }
                }
                catch (Exception ex)
                {
                    LogThread.WriteLine(ex.Message);
                    return RedirectToAction("Index", "Error");
                }

            }

            else

            {
                //  ViewBag.msg = "Verifier l code postal";
                ViewData["gouvernorat"] = 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");

                return View();
            }
        }
        public ActionResult EditDelegation(Delegation reg)
        {
            var bat = del.FindDelByID(reg.idDelegation);

            if (ModelState.IsValid)
            {
                try
                {
                    del.UpdateDelegationDetached(reg);
                    del.SaveDelegation();

                    return RedirectToAction("GetDelegation");
                }
                catch (Exception ex)
                {
                    LogThread.WriteLine(ex.Message);
                    return RedirectToAction("Index", "Error");
                }
            }
            else

            {
                //  ViewBag.msg = "Verifier l code postal";
                ViewData["gouvernorat"] = 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");

                return View();
            }
        }
예제 #5
0
 public ActionResult CreateDelegation(Delegation deleg)
 {
     try
     {
         BissInventaireEntities.Instance.Delegation.Add(deleg);
         BissInventaireEntities.Instance.SaveChanges();
         return RedirectToAction("GetDelegation");
     }
     catch (Exception ex)
     {
         LogThread.WriteLine(ex.Message);
         return RedirectToAction("Index", "Error");
     }
 }
예제 #6
0
        public ActionResult EditDelegation(Delegation reg)
        {
            var bat = del.FindDelByID(reg.idDelegation);
            try
            {
                del.UpdateDelegationDetached(reg);
            del.SaveDelegation();

            return RedirectToAction("GetDelegation");
            }
            catch (Exception ex)
            {
                LogThread.WriteLine(ex.Message);
                return RedirectToAction("Index", "Error");
            }

        }