public async Task <IActionResult> Edit(int id, [Bind("Id,Nom,Description,UrlFiche,DateAjout")] HtmlCours htmlCours) { if (id != htmlCours.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(htmlCours); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HtmlCoursExists(htmlCours.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(htmlCours)); }
public async Task <IActionResult> Create([Bind("Id,Nom,Description,UrlFiche,DateAjout")] HtmlCours htmlCours) { if (ModelState.IsValid) { htmlCours.DateAjout = DateTime.Now; _context.Add(htmlCours); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(htmlCours)); }