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
|
||||
{
|
||||
Artiste artiste = this.context.Artistes
|
||||
.Include(a => a.Titres)
|
||||
.First(a => a.IdArtiste == id);
|
||||
.Include(a => a.Titres)
|
||||
.FirstOrDefault(a => a.IdArtiste == id);
|
||||
return artiste;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -262,15 +262,13 @@ public class DbTitreRepository : ITitreRepository
|
||||
try
|
||||
{
|
||||
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
|
||||
.Include(t => t.Artiste)
|
||||
.Include(t => t.Styles)
|
||||
.Include(t => t.Commentaires)
|
||||
.First(t => t.IdTitre == idTitre);
|
||||
.FirstOrDefault(t => t.IdTitre == idTitre);
|
||||
|
||||
this.logger.LogDebug("Titre trouvé: {Libelle}", titre.Libelle);
|
||||
return titre;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
|
||||
@@ -87,6 +87,12 @@ public class ArtisteController : Controller
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
var artiste = this.artisteRepository.Find(id);
|
||||
|
||||
if (artiste == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new AdminArtisteForm
|
||||
{
|
||||
Id = id,
|
||||
|
||||
@@ -53,6 +53,11 @@ namespace Webzine.WebApplication.Areas.Administration.Controllers
|
||||
{
|
||||
var commentaire = this.commentaireRepository.Find(id);
|
||||
|
||||
if (commentaire == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new CommentaireDeleteViewModel
|
||||
{
|
||||
IdCommentaire = commentaire.IdCommentaire,
|
||||
|
||||
@@ -130,6 +130,11 @@ public class TitreController : Controller
|
||||
{
|
||||
var titre = this.titreRepository.Find(id);
|
||||
|
||||
if (titre == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new AdminTitreDelete
|
||||
{
|
||||
Id = titre.IdTitre,
|
||||
|
||||
@@ -3,11 +3,11 @@ namespace Webzine.WebApplication.Configuration;
|
||||
public enum SeederType
|
||||
{
|
||||
Local,
|
||||
Spotify
|
||||
Spotify,
|
||||
}
|
||||
|
||||
public enum RepositoryType
|
||||
{
|
||||
Local,
|
||||
Db
|
||||
Db,
|
||||
}
|
||||
Reference in New Issue
Block a user