Merge branch 'j2/feat/artiste_repository' into j2/refactor/controler-style-titre
This commit is contained in:
@@ -1,17 +1,46 @@
|
||||
using Webzine.Entity;
|
||||
|
||||
namespace Webzine.Repository.Contracts
|
||||
{
|
||||
using Webzine.Entity;
|
||||
/// <summary>
|
||||
/// Défini une interface <see cref="IArtisteRepository"/> pour gérer les opérations de base de données liées aux artistes.
|
||||
/// </summary>
|
||||
public interface IArtisteRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Ajoute un nouvel artiste.
|
||||
/// </summary>
|
||||
/// <param name="artiste">L'artiste à ajouter à la collection. Ne peut pas être null.</param>
|
||||
void Add(Artiste artiste);
|
||||
|
||||
/// <summary>
|
||||
/// Supprime un artiste.
|
||||
/// </summary>
|
||||
/// <param name="artiste">L'artiste à supprimer.</param>
|
||||
void Delete(Artiste artiste);
|
||||
|
||||
/// <summary>
|
||||
/// Récupère un artiste par son identifiant unique. Si aucun artiste n'est trouvé, retourne null.
|
||||
/// </summary>
|
||||
/// <param name="id">L'identifiant de l'artiste.</param>
|
||||
/// <returns></returns>
|
||||
Artiste Find(int id);
|
||||
/// <summary>
|
||||
/// Récupère un artiste par son nom. Si aucun artiste n'est trouvé, retourne null.
|
||||
/// </summary>
|
||||
/// <param name="name">Le nom de l'artiste.</param>
|
||||
/// <returns>L'artiste recherché ou null.</returns>
|
||||
Artiste FindByName(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Récupère tous les artistes disponibles dans la collection. Si aucun artiste n'est trouvé, retourne une collection vide.
|
||||
/// </summary>
|
||||
/// <returns>Retourne une collection d'artistes.</returns>
|
||||
IEnumerable<Artiste> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Met à jour les informations d'un artiste existant dans la collection.
|
||||
/// </summary>
|
||||
/// <param name="artiste">L'artiste à mettre à jour.</param>
|
||||
void Update(Artiste artiste);
|
||||
}
|
||||
}
|
||||
142
Webzine.Repository/DbArtisteRepository.cs
Normal file
142
Webzine.Repository/DbArtisteRepository.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
namespace Webzine.Repository
|
||||
{
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Webzine.EntitiesContext;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Initialise une classe <see cref="DbArtisteRepository"/> qui implémente l'interface <see cref="IArtisteRepository"/> pour gérer les opérations de base de données liées aux artistes.
|
||||
/// Utilise <see cref="IArtisteRepository"/> en injection de dépendances.
|
||||
/// </summary>
|
||||
public class DbArtisteRepository : IArtisteRepository
|
||||
{
|
||||
private WebzineDbContext _context;
|
||||
private readonly ILogger<LocalArtisteRepository> _logger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DbArtisteRepository"/> class.
|
||||
/// </summary>
|
||||
/// <param name="context">Le contexte de base de données à utiliser pour accéder aux entités et effectuer des opérations de
|
||||
/// persistance. Ne peut pas être null.</param>
|
||||
public DbArtisteRepository(WebzineDbContext context, ILogger<LocalArtisteRepository> logger)
|
||||
{
|
||||
this._logger = logger;
|
||||
this._context = context;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Add(Artiste artiste)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (artiste == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(artiste), "L'artiste à ajouter ne peut pas être null.");
|
||||
}
|
||||
|
||||
this._context.Artistes.Add(artiste);
|
||||
this._context.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Une erreur est survenue lors de l'ajout de l'artiste {Nom}.", artiste?.Nom);
|
||||
throw new Exception("Une erreur est survenue lors de l'ajout de l'artiste.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Delete(Artiste artiste)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (artiste == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(artiste), "L'artiste à supprimer ne peut pas être null.");
|
||||
}
|
||||
|
||||
this._context.Artistes.Remove(artiste);
|
||||
this._context.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Une erreur est survenue lors de la suppression de l'artiste {Nom}.", artiste?.Nom);
|
||||
throw new Exception("Une erreur est survenue lors de la suppression de l'artiste.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Artiste Find(int id)
|
||||
{
|
||||
Artiste artiste = this._context.Artistes
|
||||
.Include(a => a.Titres)
|
||||
.FirstOrDefault(a => a.IdArtiste == id);
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogWarning("Aucun artiste trouvé avec l'identifiant {Id}", id);
|
||||
}
|
||||
return artiste;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Artiste FindByName(string nom)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nom))
|
||||
{
|
||||
this._logger.LogWarning("Tentative de recherche avec un nom vide ou null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
var artiste = this._context.Artistes
|
||||
.Include(a => a.Titres)
|
||||
.FirstOrDefault(a => a.Nom == nom);
|
||||
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogWarning("Recherche Nom : Aucun artiste trouvé pour '{Nom}'.", nom);
|
||||
}
|
||||
|
||||
return artiste;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<Artiste> FindAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
// .AsNoTracking() rend la requête beaucoup plus rapide pour de la lecture
|
||||
var artistes = this._context.Artistes.AsNoTracking().ToList();
|
||||
this._logger.LogInformation("{Count} artistes récupérés de la base.", artistes.Count);
|
||||
return artistes;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Erreur lors de la récupération de tous les artistes.");
|
||||
return Enumerable.Empty<Artiste>(); // Retourne une liste vide au lieu de faire crash l'UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Update(Artiste artiste)
|
||||
{
|
||||
if (artiste == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(artiste));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this._context.Artistes.Update(artiste);
|
||||
this._context.SaveChanges();
|
||||
this._logger.LogInformation("Artiste {Id} ({Nom}) mis à jour avec succès.", artiste.IdArtiste, artiste.Nom);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Erreur lors de la mise à jour de l'artiste {Id}.", artiste.IdArtiste);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
133
Webzine.Repository/LocalArtisteRepository.cs
Normal file
133
Webzine.Repository/LocalArtisteRepository.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
namespace Webzine.Repository
|
||||
{
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Initialise une classe <see cref="LocalArtisteRepository"/> qui implémente l'interface <see cref="IArtisteRepository"/> pour gérer les opérations de base de données liées aux artistes.
|
||||
/// Utilise <see cref="IArtisteRepository"/> en injection de dépendances.
|
||||
/// </summary>
|
||||
public class LocalArtisteRepository : IArtisteRepository
|
||||
{
|
||||
private readonly ILogger<LocalArtisteRepository> _logger;
|
||||
private readonly List<Artiste> _artistes;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocalArtisteRepository"/> class.
|
||||
/// Est liéee à une liste d'artistes en local et utilise un logger pour enregistrer les opérations effectuées sur les artistes.
|
||||
/// </summary>
|
||||
/// <param name="artistes">La liste des artistes à initialiser. Ne peut pas être null.</param>
|
||||
/// <param name="logger">Le logger à utiliser pour enregistrer les messages de journalisation. Ne peut pas être null.</param>
|
||||
public LocalArtisteRepository(List<Artiste> artistes, ILogger<LocalArtisteRepository> logger)
|
||||
{
|
||||
this._logger = logger;
|
||||
this._artistes = artistes;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Add(Artiste artiste)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogError("L'artiste à ajouter ne peut pas être null.");
|
||||
throw new ArgumentNullException(nameof(artiste));
|
||||
}
|
||||
|
||||
if (this._artistes.Any(a => a.IdArtiste == artiste.IdArtiste))
|
||||
{
|
||||
this._logger.LogWarning("Un artiste avec l'ID {Id} existe déjà. L'ajout est ignoré.", artiste.IdArtiste);
|
||||
return;
|
||||
}
|
||||
|
||||
this._artistes.Add(artiste);
|
||||
this._logger.LogInformation("Artiste ajouté : {Nom}", artiste.Nom);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Erreur lors de l'ajout de l'artiste : {Nom}", artiste?.Nom);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Delete(Artiste artiste)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._artistes.Remove(artiste);
|
||||
this._logger.LogInformation("Artiste supprimé : {Nom}", artiste.Nom);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Erreur lors de la suppression de l'artiste : {Nom}", artiste.Nom);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Artiste Find(int id)
|
||||
{
|
||||
Artiste artiste = this._artistes.FirstOrDefault(a => a.IdArtiste == id);
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogWarning("Aucun artiste trouvé avec l'identifiant {Id}", id);
|
||||
}
|
||||
return artiste;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Artiste FindByName(string nom)
|
||||
{
|
||||
Artiste artiste = this._artistes.FirstOrDefault(a => a.Nom == nom);
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogWarning("Aucun artiste trouvé avec le nom {Nom}", nom);
|
||||
}
|
||||
return artiste;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// La liste retournée est une copie de la liste interne, donc elle ne peut être nulle.
|
||||
public IEnumerable<Artiste> FindAll()
|
||||
{
|
||||
return this._artistes;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Update(Artiste artiste)
|
||||
{
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogError("L'artiste à mettre à jour ne peut pas être null.");
|
||||
throw new ArgumentNullException(nameof(artiste));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var artisteToUpdate = this._artistes.FirstOrDefault(a => a.IdArtiste == artiste.IdArtiste);
|
||||
|
||||
if (artisteToUpdate != null)
|
||||
{
|
||||
artisteToUpdate.Nom = artiste.Nom;
|
||||
artisteToUpdate.Biographie = artiste.Biographie;
|
||||
artisteToUpdate.Titres = artiste.Titres;
|
||||
|
||||
this._logger.LogInformation("Artiste {Id} mis à jour avec succès.", artiste.IdArtiste);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._logger.LogWarning("Mise à jour impossible : l'artiste avec l'ID {Id} n'existe pas.", artiste.IdArtiste);
|
||||
throw new KeyNotFoundException($"L'artiste {artiste.IdArtiste} est introuvable.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.LogError(ex, "Une erreur est survenue lors de la mise à jour de l'artiste {Id}.", artiste.IdArtiste);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Entity.Fixtures;
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Areas.Administration.ViewModels.Artiste;
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
@@ -10,16 +11,17 @@ public class ArtisteController : Controller
|
||||
{
|
||||
// Injection du logger via le constructeur
|
||||
private readonly ILogger<ArtisteController> _logger;
|
||||
private readonly List<Artiste> _artistes;
|
||||
private readonly IArtisteRepository _artisteRepository;
|
||||
private readonly List<Artiste> _artistes = new List<Artiste>();
|
||||
|
||||
|
||||
public ArtisteController(ILogger<ArtisteController> logger)
|
||||
public ArtisteController(ILogger<ArtisteController> logger,
|
||||
IArtisteRepository artisteRepository)
|
||||
{
|
||||
this._logger = logger;
|
||||
this._logger.LogDebug(1, "initialisation du ArtisteController d'administration");
|
||||
var factory = new DataFactory();
|
||||
|
||||
_artistes = factory.GenerateArtists(10);
|
||||
this._artisteRepository = artisteRepository;
|
||||
this._artistes.AddRange(this._artisteRepository.FindAll());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,9 +32,7 @@ public class ArtisteController : Controller
|
||||
public IActionResult Index()
|
||||
{
|
||||
|
||||
var _artistes_ordre = _artistes.OrderBy(t => t.Nom).ToList();
|
||||
|
||||
this._logger.LogInformation("Initialisation du contrôleur TitreController pour l'Administration.");
|
||||
var _artistes_ordre = this._artistes.OrderBy(t => t.Nom).ToList();
|
||||
|
||||
return View(_artistes_ordre);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class ArtisteController : Controller
|
||||
/// <returns>Redirection.</returns>
|
||||
public IActionResult Edit(int id)
|
||||
{
|
||||
var artiste = _artistes.First(t => t.IdArtiste == id);
|
||||
var artiste = this._artistes.First(t => t.IdArtiste == id);
|
||||
|
||||
var model = new AdminArtisteForm
|
||||
{
|
||||
@@ -79,7 +79,7 @@ public class ArtisteController : Controller
|
||||
/// <returns>Redirection.></returns>
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
var artiste = _artistes.First(t => t.IdArtiste == id);
|
||||
var artiste = this._artistes.First(t => t.IdArtiste == id);
|
||||
var model = new AdminArtisteForm
|
||||
{
|
||||
Id = id,
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Webzine.Entity.Fixtures;
|
||||
|
||||
namespace Webzine.WebApplication.Controllers
|
||||
namespace Webzine.WebApplication.Controllers
|
||||
{
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Webzine.Entity.Fixtures;
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.ViewModels.Artiste;
|
||||
|
||||
public class ArtisteController : Controller
|
||||
{
|
||||
// Injection du logger via le constructeur
|
||||
private readonly ILogger<ArtisteController> logger;
|
||||
private readonly ILogger<ArtisteController> _logger;
|
||||
private readonly IArtisteRepository _artisteRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Initialise une nouvelle instance de la classe <see cref="ArtisteController"/>.
|
||||
/// Initialise une nouvelle instance du <see cref="ArtisteController"/>. avec un service de journalisation injecté.
|
||||
/// </summary>
|
||||
/// <param name="logger">Service de journalisation injecté pour enregistrer les événements et les erreurs.</param>
|
||||
public ArtisteController(ILogger<ArtisteController> logger)
|
||||
public ArtisteController(ILogger<ArtisteController> logger,
|
||||
IArtisteRepository artisteRepository)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.logger.LogDebug(1, "initialisation du ArtisteController");
|
||||
this._logger = logger;
|
||||
this._logger.LogDebug("Initialisation du ArtisteController");
|
||||
this._artisteRepository = artisteRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,8 +35,8 @@ namespace Webzine.WebApplication.Controllers
|
||||
|
||||
if (string.IsNullOrEmpty(nom))
|
||||
{
|
||||
this.logger.LogWarning("Nom de l'artiste manquant dans la requête.");
|
||||
return this.RedirectToAction("Index", "Accueil");
|
||||
this._logger.LogWarning("Nom de l'artiste manquant dans la requête.");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
// On transforme "fatal-bazooka" en "Fatal Bazooka" pour la factory
|
||||
@@ -39,11 +44,28 @@ namespace Webzine.WebApplication.Controllers
|
||||
.ToTitleCase(nom.Replace("-", " "));
|
||||
|
||||
// On appelle la factory pour obtenir l'artiste unique
|
||||
var artiste = ArtisteFactory.SeedArtisteByName(nomPropre);
|
||||
var artiste = this._artisteRepository.FindByName(nomPropre);
|
||||
|
||||
this.logger.LogInformation("Artiste trouvé : {NomArtiste}", nom);
|
||||
if (artiste == null)
|
||||
{
|
||||
this._logger.LogWarning("Artiste non trouvé pour le nom : {NomArtiste}", nomPropre);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
var viewModel = new ArtisteDetailsViewModel
|
||||
{
|
||||
IdArtiste = artiste.IdArtiste,
|
||||
Nom = artiste.Nom,
|
||||
Biographie = artiste.Biographie,
|
||||
// On effectue le groupement ici une bonne fois pour toutes
|
||||
AlbumsGroupes = artiste.Titres
|
||||
.OrderBy(t => t.Libelle)
|
||||
.GroupBy(t => t.Album)
|
||||
.OrderBy(g => g.Key),
|
||||
};
|
||||
|
||||
return this.View(artiste);
|
||||
this._logger.LogInformation("Artiste trouvé : {NomArtiste}", nom);
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ try
|
||||
{
|
||||
builder.Services.AddScoped<ITitreRepository, DbTitreRepository>();
|
||||
builder.Services.AddScoped<IStyleRepository, DbStyleRepository>();
|
||||
//builder.Services.AddScoped<IArtisteRepository, DbArtisteRepository>();
|
||||
builder.Services.AddScoped<IArtisteRepository, DbArtisteRepository>();
|
||||
//builder.Services.AddScoped<ICommentaireRepository, DbCommentaireRepository>();
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Services.AddScoped<ITitreRepository, LocalTitreRepository>();
|
||||
builder.Services.AddScoped<IStyleRepository, LocalStyleRepository>();
|
||||
//builder.Services.AddScoped<IArtisteRepository, LocalArtisteRepository>();
|
||||
builder.Services.AddScoped<IArtisteRepository, LocalArtisteRepository>();
|
||||
//builder.Services.AddScoped<ICommentaireRepository, LocalCommentaireRepository>();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Webzine.WebApplication.ViewModels.Artiste
|
||||
{
|
||||
using Webzine.Entity;
|
||||
/// <summary>
|
||||
/// ViewModel pour afficher les informations d'un artiste et ses titres groupés par album.
|
||||
/// </summary>
|
||||
public class ArtisteDetailsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Obtient ou définit l'identifiant de l'artiste.
|
||||
/// </summary>
|
||||
public int IdArtiste { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit le nom de l'artiste.
|
||||
/// </summary>
|
||||
public string Nom { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit la biographie de l'artiste.
|
||||
/// </summary>
|
||||
public string Biographie { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit défini la liste des titres de l'artiste groupés par nom d'Album.
|
||||
/// </summary>
|
||||
public IEnumerable<IGrouping<string?, Titre>> AlbumsGroupes { get; set; }
|
||||
= Enumerable.Empty<IGrouping<string?, Titre>>();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Webzine.Entity.Artiste
|
||||
@model Webzine.WebApplication.ViewModels.Artiste.ArtisteDetailsViewModel;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Artiste";
|
||||
@@ -8,22 +8,20 @@
|
||||
<div class="container">
|
||||
<h1>@Model.Nom</h1>
|
||||
|
||||
<hr class="mb-5" />
|
||||
<hr/>
|
||||
|
||||
<p class="lead">@Model.Biographie</p>
|
||||
|
||||
<h2 class="mt-5 mb-4">Albums</h2>
|
||||
<hr class="mb-5" />
|
||||
<hr/>
|
||||
|
||||
@* On groupe les titres par nom d'album *@
|
||||
@{
|
||||
var albumsGroupes = Model.Titres
|
||||
.OrderBy(t => t.Libelle) // Trie les titres par ordre alphabétique au sein de chaque groupe futur
|
||||
.GroupBy(t => t.Album) // Groupe par nom d'album
|
||||
.OrderBy(g => g.Key); // Trie les albums par ordre alphabétique (la clé du groupe)
|
||||
}
|
||||
|
||||
@foreach (var groupe in albumsGroupes)
|
||||
@if (!Model.AlbumsGroupes.Any())
|
||||
{
|
||||
<p>Cet artiste n'a pas encore de titres répertoriés.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var groupe in Model.AlbumsGroupes)
|
||||
{
|
||||
// On récupère le premier titre du groupe pour afficher l'image de l'album
|
||||
var premierTitre = groupe.First();
|
||||
@@ -71,4 +69,5 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
Reference in New Issue
Block a user