public async Task <IActionResult> Edit(int id, [Bind("Id,Nom,Prenom,Age")] Locataires locataires) { if (id != locataires.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locataires); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocatairesExists(locataires.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(locataires)); }
public async Task <IActionResult> Create([Bind("Id,Nom,Prenom,Age")] Locataires locataires) { if (ModelState.IsValid) { _context.Add(locataires); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(locataires)); }