Merge remote-tracking branch 'origin/main' into dev

This commit is contained in:
Loic Masi
2026-04-09 14:10:43 +02:00
5 changed files with 12 additions and 16 deletions

View File

@@ -57,7 +57,7 @@ public class TitreAdminService : ITitreAdminService
Album = commande.Album, Album = commande.Album,
Chronique = commande.Chronique, Chronique = commande.Chronique,
DateCreation = DateTime.UtcNow, DateCreation = DateTime.UtcNow,
DateSortie = commande.DateSortie, DateSortie = DateTime.SpecifyKind(commande.DateSortie, DateTimeKind.Utc),
Duree = commande.Duree, Duree = commande.Duree,
UrlJaquette = commande.UrlJaquette, UrlJaquette = commande.UrlJaquette,
UrlEcoute = commande.UrlEcoute ?? string.Empty, UrlEcoute = commande.UrlEcoute ?? string.Empty,
@@ -84,7 +84,7 @@ public class TitreAdminService : ITitreAdminService
existant.Libelle = commande.Libelle; existant.Libelle = commande.Libelle;
existant.Album = commande.Album; existant.Album = commande.Album;
existant.Chronique = commande.Chronique; existant.Chronique = commande.Chronique;
existant.DateSortie = commande.DateSortie; existant.DateSortie = DateTime.SpecifyKind(commande.DateSortie, DateTimeKind.Utc);
existant.Duree = commande.Duree; existant.Duree = commande.Duree;
existant.UrlJaquette = commande.UrlJaquette; existant.UrlJaquette = commande.UrlJaquette;
existant.UrlEcoute = commande.UrlEcoute ?? string.Empty; existant.UrlEcoute = commande.UrlEcoute ?? string.Empty;

View File

@@ -187,12 +187,14 @@ public class DbTitreRepository : ITitreRepository
Titre existingTitre = this.Find(titre.IdTitre); Titre existingTitre = this.Find(titre.IdTitre);
if (existingTitre != null) if (existingTitre != null)
{ {
List<Style> stylesToApply = titre.Styles.ToList();
this.context.Entry(existingTitre).CurrentValues.SetValues(titre); this.context.Entry(existingTitre).CurrentValues.SetValues(titre);
// Relation many-to-many // Relation many-to-many
this.context.Entry(existingTitre).Collection(t => t.Styles).Load(); this.context.Entry(existingTitre).Collection(t => t.Styles).Load();
existingTitre.Styles.Clear(); existingTitre.Styles.Clear();
foreach (var style in titre.Styles) foreach (var style in stylesToApply)
{ {
existingTitre.Styles.Add(style); existingTitre.Styles.Add(style);
} }

View File

@@ -141,7 +141,6 @@ public class TitreController : Controller
return this.View(form); return this.View(form);
} }
model.DateSortie = DateTime.Parse(model.DateSortie.ToString());
this.titreAdminService.CreerTitre(model); this.titreAdminService.CreerTitre(model);
return this.RedirectToAction("Index"); return this.RedirectToAction("Index");
} }

View File

@@ -45,13 +45,12 @@
<!-- DATE + DUREE --> <!-- DATE + DUREE -->
<div class="row mb-3 align-items-center"> <div class="row mb-3 align-items-center">
<label class="col-md-3 col-form-label">Date de sortie<span class="text-danger">*</span></label> <label class="col-md-3 col-form-label">
Date de sortie<span class="text-danger">*</span>
</label>
<div class="col-md-3"> <div class="col-md-3">
<input type="text" <input asp-for="DateSortie" type="date" class="form-control" />
class="form-control" <span asp-validation-for="DateSortie" class="text-danger"></span>
name="DateSortie"
pattern="\d{2}/\d{2}/\d{4}"
value="@Model.DateSortie.ToString("d")"/>
</div> </div>
<label class="col-md-3 col-form-label">Durée en secondes<span class="text-danger">*</span></label> <label class="col-md-3 col-form-label">Durée en secondes<span class="text-danger">*</span></label>

View File

@@ -43,15 +43,11 @@
return this.RedirectToAction("Index", "Accueil"); return this.RedirectToAction("Index", "Accueil");
} }
// On transforme "fatal-bazooka" en "Fatal Bazooka" var artiste = this.artisteRepository.FindByName(nom);
string nomPropre = System.Globalization.CultureInfo.CurrentCulture.TextInfo
.ToTitleCase(nom.Replace("-", " "));
var artiste = this.artisteRepository.FindByName(nomPropre);
if (artiste == null) if (artiste == null)
{ {
this.logger.LogWarning("Artiste non trouvé avec le nom : {NomArtiste}", nomPropre); this.logger.LogWarning("Artiste non trouvé avec le nom : {NomArtiste}", nom);
return this.RedirectToAction("Index", "Accueil"); return this.RedirectToAction("Index", "Accueil");
} }