public ActionResult Edit(Categorie categorie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categorie).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(categorie);
 }
        public ActionResult Create(Categorie categorie)
        {
            if (ModelState.IsValid && !string.IsNullOrEmpty(categorie.Nom))
            {
                db.Categories.Add(categorie);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ErrorMessage = "Nom de catégorie invalide";
            return View(categorie);
        }