public ActionResult createSousModele(Sous_modele sousModele, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if(etat)
                    {
                        BissInventaireEntities.Instance.Sous_modele.Add(sousModele);
                        BissInventaireEntities.Instance.SaveChanges();
                        return RedirectToAction("getSousModele");
                    }
                  else
                    {
                        return RedirectToAction("Index","Error");
                    }
                }
                catch (Exception ex)
                {
                    LogThread.WriteLine(ex.Message);
                    return RedirectToAction("Index", "Error");
                }
            }
            else

            {

                return View();
            }
        }
        public ActionResult EditSousModele(Sous_modele sousModele)
        {
            if (ModelState.IsValid)
            {
                //try
                //{
                    db.UpdateSous_ModeleDetached(sousModele);
                    db.SaveSousModele();
                    return RedirectToAction("getSousModele");
                //}
                //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();
            }
        }
Ejemplo n.º 3
0
 public  void UpdateSous_ModeleDetached(Sous_modele e)
   {
       utOfWork.CategorieRepository.UpdateSous_ModeleDetached(e);
   }