public void UpdateSous_categorieDetached(Sous_categorie e)
        {
            Sous_categorie existing = FindSous_categorieById(e.id_sous_categorie);

            ((IObjectContextAdapter)DataContext).ObjectContext.Detach(existing);
            this.DataContext.Entry(e).State = EntityState.Modified;
        }
        public ActionResult createSousCategorie(Sous_categorie sousCategorie, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (etat)
                    {
                        BissInventaireEntities.Instance.Sous_categorie.Add(sousCategorie);
                        BissInventaireEntities.Instance.SaveChanges();
                        return(RedirectToAction("getSousCategorie"));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Error"));
                    }
                }
                catch (Exception ex)
                {
                    LogThread.WriteLine(ex.Message);
                    return(RedirectToAction("Index", "Error"));
                }
            }
            else

            {
                ViewData["categorie"] = new SelectList(BissInventaireEntities.Instance.Categorie.ToList(), "Id_categorie", "libelle");
                return(View());
            }
        }
        public ActionResult EditSousCategorie(Sous_categorie Sous_categorie)
        {
            if (ModelState.IsValid)
            {
                //try
                //{
                db.UpdateSous_categorieDetached(Sous_categorie);
                db.SaveSousCategorie();
                return(RedirectToAction("getSousCategorie"));
                //catch (Exception ex)
                //{
                //    LogThread.WriteLine(ex.Message);
                //    return RedirectToAction("Index", "Error");
                //}
            }
            else

            {
                ViewData["categorie"] = new SelectList(BissInventaireEntities.Instance.Categorie.ToList(), "Id_categorie", "libelle");
                return(View());
            }
        }
 public void UpdateSous_categorieDetached(Sous_categorie e)
 {
     utOfWork.CategorieRepository.UpdateSous_categorieDetached(e);
 }
 public void UpdateCategorie_DesignationDetached(Sous_categorie e)
 {
     utOfWork.CategorieRepository.UpdateCategorie_DesignationDetached(e);
 }