@using KernelRecordsMVC.Domain.Enums @model KernelRecordsMVC.Models.Release @{ ViewData["Title"] = Model.Title; var isAlbum = Model.Album != null; var isSingle = Model.SingleRelease != null; var releaseType = isAlbum ? "ALBUM" : isSingle ? "SINGLE" : "RELEASE"; var artists = string.Join( ", ", Model.ReleaseArtists .OrderBy(x => x.ReleaseOrdinal) .Select(x => x.Artist.ArtistName) ); }
@if (!string.IsNullOrWhiteSpace(Model.CoverPhoto)) { @Model.Title } else {
♪
}
@releaseType

@Model.Title

@artists

Genre @Model.Genre
Released @Model.ReleaseDate.ToString("MMM dd, yyyy")
Label @(string.IsNullOrWhiteSpace(Model.RecordLabel) ? "Independent" : Model.RecordLabel)
@foreach (var artist in Model.ReleaseArtists .OrderBy(x => x.ReleaseOrdinal)) { @artist.Artist.ArtistName @if (artist.Type.ToString() == "FEATURE") { Featured } }

Choose your format

@Model.Products.Count product(s)
@if (!Model.Products.Any()) {
No physical products are currently available.
} else {
@foreach (var product in Model.Products .OrderBy(x => x.Format)) { var latestModification = product.ModificationProducts? .Select(mp => mp.Modification) .OrderByDescending(m => m.DateModified) .ThenByDescending(m => m.ModificationId) .FirstOrDefault(); var isDiscounted = latestModification != null && latestModification.TypeOfModification == ModificationType.DISCOUNT && latestModification.Discount.HasValue && latestModification.Discount.Value > 0 && latestModification.Discount.Value < 100; decimal? originalPrice = null; decimal? discountPercentage = null; if (isDiscounted) { discountPercentage = latestModification!.Discount!.Value; originalPrice = Math.Round( product.Price / (1m - discountPercentage.Value / 100m), 2, MidpointRounding.AwayFromZero); }
@product.Format @if (product.Stock > 0) { In stock } else { Out of stock }
@if (isDiscounted && originalPrice.HasValue && discountPercentage.HasValue) {
@originalPrice.Value.ToString("C") @product.Price.ToString("C")
-@discountPercentage.Value.ToString("0.##")%
} else {
@product.Price.ToString("C")
}

@product.ProductDescription

@if (product.Stock > 0) {
Add to Cart
@Html.AntiForgeryToken()
} else {
@Html.AntiForgeryToken()
}
}
}
@if (Model.Album != null) {

Track List

@Model.Album.AlbumSongs.Count tracks
@if (!Model.Album.AlbumSongs.Any()) {
No tracks have been added to this album.
} else {
    @{ var trackNumber = 1; } @foreach (var albumSong in Model.Album.AlbumSongs .OrderBy(x => x.SongId)) {
  1. @trackNumber.ToString("00")
    @albumSong.Song.SongName @if (albumSong.Song.SongArtists != null && albumSong.Song.SongArtists.Any()) {
    @string.Join( ", ", albumSong.Song.SongArtists .OrderBy(x => x.SongOrdinal) .Select(x => x.Artist.ArtistName) )
    }
    @albumSong.Song.SongDuration
  2. trackNumber++; }
}
} @if (Model.SingleRelease != null) {

Single Information

Single

Duration @Model.SingleRelease.Duration
}