public async Task <IActionResult> Edit(int id, [Bind("AyantDroitID,nom,prenom,sexe,dateNaissance,designation,ImageADr,description,DateCreation,HeritierID")] AyantDroit ayantDroit) { if (id != ayantDroit.AyantDroitID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ayantDroit); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AyantDroitExists(ayantDroit.AyantDroitID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HeritierID"] = new SelectList(_context.heritiers, "HeritierID", "HeritierID", ayantDroit.HeritierID); return(View(ayantDroit)); }
public ActionResult DeleteConfirmed(int id) { AyantDroit ayantDroit = db.AyantDroit.Find(id); db.AyantDroit.Remove(ayantDroit); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ADrID,Prenom,Nom,Adresse,Age,Sexe,TypeHeritier,Description,NomenclatureID")] AyantDroit ayantDroit) { if (ModelState.IsValid) { db.Entry(ayantDroit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.NomenclatureID = new SelectList(db.Heritier, "NomenclatureID", "Sexe", ayantDroit.NomenclatureID); return(View(ayantDroit)); }
public async Task <IActionResult> Create([Bind("AyantDroitID,nom,prenom,sexe,dateNaissance,designation,ImageADr,description,DateCreation,HeritierID")] AyantDroit ayantDroit) { if (ModelState.IsValid) { _context.Add(ayantDroit); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["illustration"] = new SelectList(_context.heritiers, "illustration", "illustration", ayantDroit.typeHeritier.illustration); return(View(ayantDroit)); }
// GET: AyantDroits/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AyantDroit ayantDroit = db.AyantDroit.Find(id); if (ayantDroit == null) { return(HttpNotFound()); } return(View(ayantDroit)); }
// GET: AyantDroits/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AyantDroit ayantDroit = db.AyantDroit.Find(id); if (ayantDroit == null) { return(HttpNotFound()); } ViewBag.NomenclatureID = new SelectList(db.Heritier, "NomenclatureID", "Sexe", ayantDroit.NomenclatureID); return(View(ayantDroit)); }