public PeriodesPivot GetPeriodes(long id)
        {
            var           item         = periodeRepository.GetById((int)id);
            PeriodesPivot periodePivot = Mapper.Map <GEN_Periodes, PeriodesPivot>(item);

            return(periodePivot);
        }
        public ActionResult DeleteConfirmed([Bind(Include = "Id")] PeriodesFormViewModel peroidess)
        {
            PeriodesPivot peroides = Mapper.Map <PeriodesFormViewModel, PeriodesPivot>(peroidess);
            PeriodesPivot per      = peroideServise.GetPeriodes(peroides.Id);


            peroideServise.DeletePeriodes(per);
            // db.SaveChanges();
            peroideServise.SavePeriodes();
            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PeriodesPivot peroide = peroideServise.GetPeriodes((int)id);

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

            PeriodesFormViewModel peroides = Mapper.Map <PeriodesPivot, PeriodesFormViewModel>(peroide);

            return(View(peroides));
        }
        public ActionResult Edit([Bind(Include = "Id,Libelle,DateDebut,DateFin,Actif,ComptaCloture,GescomCloture,PaieCloture,IdExercice")] PeriodesPivot peroide)
        {
            if (ModelState.IsValid)
            {
                peroide.Actif            = true;
                peroide.sys_dateUpdate   = DateTime.Now;
                peroide.sys_dateCreation = DateTime.Now;
                peroide.sys_user         = Constantes.IdentifiantUser;
                peroide.IdExercice       = 1;
                peroideServise.UpdatePeriodes(peroide);
                //   db.SaveChanges();
                peroideServise.SavePeriodes();
                return(RedirectToAction("Index"));
            }

            PeriodesFormViewModel Num = Mapper.Map <PeriodesPivot, PeriodesFormViewModel>(peroide);

            return(View(Num));
        }
        public ActionResult Create([Bind(Include = "Id,Libelle,DateDebut,DateFin,Actif,ComptaCloture,GescomCloture,PaieCloture,IdExercice")] PeriodesPivot pero)
        {
            if (pero != null)
            {
                if (pero.Id > 0)
                {
                    pero.sys_dateUpdate   = DateTime.Now;
                    pero.sys_dateCreation = DateTime.Now;
                    pero.sys_user         = Constantes.IdentifiantUser;
                    pero.Actif            = true;

                    pero.IdExercice = 1;

                    peroideServise.UpdatePeriodes(pero);
                    peroideServise.SavePeriodes();
                }
                else
                {
                    pero.Actif            = true;
                    pero.sys_dateUpdate   = DateTime.Now;
                    pero.sys_dateCreation = DateTime.Now;
                    pero.sys_user         = Constantes.IdentifiantUser;
                    pero.IdExercice       = 1;

                    peroideServise.CreatePeriodes(pero);
                    peroideServise.SavePeriodes();
                }


                return(RedirectToAction("Index"));
            }

            PeriodesFormViewModel per = Mapper.Map <PeriodesPivot, PeriodesFormViewModel>(pero);

            return(View(per));
        }
 public void UpdatePeriodes(PeriodesPivot Periodes)
 {
     periodeRepository.Update(Mapper.Map <PeriodesPivot, GEN_Periodes>(Periodes));
 }
 public void DeletePeriodes(PeriodesPivot Periodes)
 {
     periodeRepository.Delete(Periodes.Id, Mapper.Map <PeriodesPivot, GEN_Periodes>(Periodes));
 }
        public void CreatePeriodes(PeriodesPivot Periodes)
        {
            GEN_Periodes item = Mapper.Map <PeriodesPivot, GEN_Periodes>(Periodes);

            periodeRepository.Add(item);
        }