#162 : Patch bug lors de retour sur une page "Delete" après la suppression d'un élément. Redirection sur la page "Index" en cas de retour en arrière de la part d'un utilisateur.
This commit is contained in:
@@ -83,8 +83,8 @@ namespace Webzine.Repository
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Artiste artiste = this.context.Artistes
|
Artiste artiste = this.context.Artistes
|
||||||
.Include(a => a.Titres)
|
.Include(a => a.Titres)
|
||||||
.First(a => a.IdArtiste == id);
|
.FirstOrDefault(a => a.IdArtiste == id);
|
||||||
return artiste;
|
return artiste;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -262,7 +262,6 @@ public class DbTitreRepository : ITitreRepository
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.logger.LogDebug("Recherche du titre avec l'ID: {IdTitre}", idTitre);
|
this.logger.LogDebug("Recherche du titre avec l'ID: {IdTitre}", idTitre);
|
||||||
this.logger.LogDebug("Préparation de la requête avec les inclusions Artiste, Styles et Commentaires");
|
|
||||||
|
|
||||||
var titre = this.context.Titres
|
var titre = this.context.Titres
|
||||||
.Include(t => t.Artiste)
|
.Include(t => t.Artiste)
|
||||||
@@ -270,7 +269,6 @@ public class DbTitreRepository : ITitreRepository
|
|||||||
.Include(t => t.Commentaires)
|
.Include(t => t.Commentaires)
|
||||||
.FirstOrDefault(t => t.IdTitre == idTitre);
|
.FirstOrDefault(t => t.IdTitre == idTitre);
|
||||||
|
|
||||||
this.logger.LogDebug("Titre trouvé: {Libelle}", titre.Libelle);
|
|
||||||
return titre;
|
return titre;
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ public class ArtisteController : Controller
|
|||||||
public IActionResult Delete(int id)
|
public IActionResult Delete(int id)
|
||||||
{
|
{
|
||||||
var artiste = this.artisteRepository.Find(id);
|
var artiste = this.artisteRepository.Find(id);
|
||||||
|
|
||||||
|
if (artiste == null)
|
||||||
|
{
|
||||||
|
return this.RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
var model = new AdminArtisteForm
|
var model = new AdminArtisteForm
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ namespace Webzine.WebApplication.Areas.Administration.Controllers
|
|||||||
{
|
{
|
||||||
var commentaire = this.commentaireRepository.Find(id);
|
var commentaire = this.commentaireRepository.Find(id);
|
||||||
|
|
||||||
|
if (commentaire == null)
|
||||||
|
{
|
||||||
|
return this.RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
var model = new CommentaireDeleteViewModel
|
var model = new CommentaireDeleteViewModel
|
||||||
{
|
{
|
||||||
IdCommentaire = commentaire.IdCommentaire,
|
IdCommentaire = commentaire.IdCommentaire,
|
||||||
|
|||||||
@@ -130,6 +130,11 @@ public class TitreController : Controller
|
|||||||
{
|
{
|
||||||
var titre = this.titreRepository.Find(id);
|
var titre = this.titreRepository.Find(id);
|
||||||
|
|
||||||
|
if (titre == null)
|
||||||
|
{
|
||||||
|
return this.RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
var model = new AdminTitreDelete
|
var model = new AdminTitreDelete
|
||||||
{
|
{
|
||||||
Id = titre.IdTitre,
|
Id = titre.IdTitre,
|
||||||
|
|||||||
Reference in New Issue
Block a user