public ActionResult DeleteConfirmed([Bind(Include = "Id")] CPT_LettrageFormViewModel cpt_Lettrage)
        {
            LettragePivot cods  = Mapper.Map <CPT_LettrageFormViewModel, LettragePivot>(cpt_Lettrage);
            LettragePivot codes = LettrageServise.GetLettrage(cods.Id);


            LettrageServise.DeletLettragePivot(codes);
            // db.SaveChanges();
            LettrageServise.SaveLettragePivot();
            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(long?id)
        {
            //ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier");
            //db.GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier");
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LettragePivot cpt_Lettrage = LettrageServise.GetLettrage((int)id);

            //db.GEN_Devises.Find(id);
            if (cpt_Lettrage == null)
            {
                return(HttpNotFound());
            }

            CPT_LettrageFormViewModel cpt_codd = Mapper.Map <LettragePivot, CPT_LettrageFormViewModel>(cpt_Lettrage);

            return(View(cpt_codd));
        }
        public ActionResult Edit([Bind(Include = "Id,IdEcheance,MontantRegle,CodeLettrage,DateLettrage")] LettragePivot cpt_Lettrage)
        {
            if (ModelState.IsValid)
            {
                // cpt_Lettrage.IdDossier = Constantes.IdentifiantDossier;
                cpt_Lettrage.sys_dateUpdate   = DateTime.Now;
                cpt_Lettrage.sys_dateCreation = DateTime.Now;
                cpt_Lettrage.sys_user         = Constantes.IdentifiantUser;
                cpt_Lettrage.IdEcheance       = null;
                LettrageServise.UpdateLettragePivot(cpt_Lettrage);
                //   db.SaveChanges();
                LettrageServise.SaveLettragePivot();
                return(RedirectToAction("Index"));
            }
            // ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier", cpt_Journaux.IdDossier);
            //db.GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier", gEN_Devises.IdDossier);

            CPT_LettrageFormViewModel cpt_LettrageFormModel = Mapper.Map <LettragePivot, CPT_LettrageFormViewModel>(cpt_Lettrage);

            return(View(cpt_LettrageFormModel));
        }
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            // DevisesPivot gEN_Devises = deviseServise.GetDevise(id);
            LettragePivot cpt_Lettrage = LettrageServise.GetLettrage((int)id);

            //db.GEN_Devises.Find(id);
            if (cpt_Lettrage == null)
            {
                return(HttpNotFound());
            }
            // ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier", cpt_Journaux.IdDossier);
            //db.GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier", gEN_Devises.IdDossier);

            CPT_LettrageFormViewModel cpt_LettrageFormModel = Mapper.Map <LettragePivot, CPT_LettrageFormViewModel>(cpt_Lettrage);

            return(View(cpt_LettrageFormModel));
        }
 public ActionResult Create(long?id)
 {
     if (id == null)
     {
         //  ViewBag.IdDossier = new SelectList(GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier");
         ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier");
         return(View());
     }
     else
     {
         // GEN_Devises gEN_Devises = db.GEN_Devises.Find(id);
         var cpt_Lettrage = LettrageServise.GetLettrage((int)id);
         if (cpt_Lettrage == null)
         {
             TempData["errorMessage"] = "Le lettrage que vous cherchez n'existe pas.";
             return(RedirectToAction("Index"));
         }
         //  ViewBag.IdDossier = new SelectList(db.GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier", gEN_Devises.IdDossier);
         //   ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier");
         CPT_LettrageFormViewModel cpt_LettrageFormModel = Mapper.Map <LettragePivot, CPT_LettrageFormViewModel>(cpt_Lettrage);
         return(View(cpt_LettrageFormModel));
     }
 }