public async Task <IActionResult> Edit(int id, [Bind("DossierId,DateInscription,NbDemiJourneesInscrit,NbDemiJourneesAbsent,MedecinTraitant,EnfantId,Visible")] DossierInscription dossierInscription) { if (id != dossierInscription.DossierId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dossierInscription); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DossierInscriptionExists(dossierInscription.DossierId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EnfantId"] = new SelectList(_context.Enfants, "EnfantId", "EnfantId", dossierInscription.EnfantId); return(View(dossierInscription)); }
public async Task <IActionResult> Create([Bind("DossierId,DateInscription,NbDemiJourneesInscrit,NbDemiJourneesAbsent,MedecinTraitant,EnfantId,Visible")] DossierInscription dossierInscription) { if (ModelState.IsValid) { _context.Add(dossierInscription); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EnfantId"] = new SelectList(_context.Enfants, "EnfantId", "EnfantId", dossierInscription.EnfantId); return(View(dossierInscription)); }