refactor: simplifier les actions du contrôleur en supprimant les contrôles ModelState redondants et en améliorant la récupération des données

This commit is contained in:
mirage
2026-04-02 15:57:52 +02:00
parent 6ccb8173ee
commit 8acafbfe49
16 changed files with 158 additions and 61 deletions

View File

@@ -95,13 +95,8 @@ public class TitreController : Controller
[HttpPost]
public IActionResult Create(TitreAdminDTO model)
{
if (this.ModelState.IsValid)
{
this.titreAdminService.CreerTitre(model);
return this.RedirectToAction("Index");
}
return this.View(model);
this.titreAdminService.CreerTitre(model);
return this.RedirectToAction("Index");
}
/// <summary>
@@ -152,13 +147,8 @@ public class TitreController : Controller
[HttpPost]
public IActionResult Edit(TitreAdminDTO model)
{
if (this.ModelState.IsValid)
{
this.titreAdminService.ModifierTitre(model);
return this.RedirectToAction("Index");
}
return this.View(model);
this.titreAdminService.ModifierTitre(model);
return this.RedirectToAction("Index");
}
/// <summary>