Merge pull request 'Suppresion de bug lors d'un retour sur une page "Delete" après la suppression d'un élément.' (#165) from j3/bug_suppresion_dashboard into dev
Reviewed-on: https://10.4.0.131/gitea/DI1-P4-E1/Webzine/pulls/165 Reviewed-by: j.vetu <josephine.vetu@diiage.org>
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,15 +262,13 @@ 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)
|
||||||
.Include(t => t.Styles)
|
.Include(t => t.Styles)
|
||||||
.Include(t => t.Commentaires)
|
.Include(t => t.Commentaires)
|
||||||
.First(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,
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ namespace Webzine.WebApplication.Configuration;
|
|||||||
public enum SeederType
|
public enum SeederType
|
||||||
{
|
{
|
||||||
Local,
|
Local,
|
||||||
Spotify
|
Spotify,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RepositoryType
|
public enum RepositoryType
|
||||||
{
|
{
|
||||||
Local,
|
Local,
|
||||||
Db
|
Db,
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user