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

View File

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

View File

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

View File

@@ -45,13 +45,12 @@
<!-- DATE + DUREE -->
<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">
<input type="text"
class="form-control"
name="DateSortie"
pattern="\d{2}/\d{2}/\d{4}"
value="@Model.DateSortie.ToString("d")"/>
<input asp-for="DateSortie" type="date" class="form-control" />
<span asp-validation-for="DateSortie" class="text-danger"></span>
</div>
<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");
}
// On transforme "fatal-bazooka" en "Fatal Bazooka"
string nomPropre = System.Globalization.CultureInfo.CurrentCulture.TextInfo
.ToTitleCase(nom.Replace("-", " "));
var artiste = this.artisteRepository.FindByName(nomPropre);
var artiste = this.artisteRepository.FindByName(nom);
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");
}