public ActionResult createMarque(Marque marque, FormCollection collection) { if (ModelState.IsValid) { try { if (etat) { BissInventaireEntities.Instance.Marque.Add(marque); BissInventaireEntities.Instance.SaveChanges(); return RedirectToAction("getMarque"); } 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 EditMarque(Marque Catm) { if (ModelState.IsValid) { try { db.UpdateMarqueDetached(Catm); db.SaveMarque(); return RedirectToAction("getMarque"); } 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 UpdateMarqueDetached(Marque e) { utOfWork.CategorieRepository.UpdateMarqueDetached(e); }