@model LocationDetailViewModel @{ ViewData["Title"] = Model.Location.LocationName; ViewData["ProjectSection"] = "Locations"; var firstScene = Model.Scenes.FirstOrDefault(); var knownNames = Model.Aliases .Select(x => x.Alias) .Append(Model.Location.LocationName) .Where(name => !string.IsNullOrWhiteSpace(name)) .Distinct(StringComparer.OrdinalIgnoreCase) .OrderBy(name => !string.Equals(name, Model.Location.LocationName, StringComparison.OrdinalIgnoreCase)) .ThenBy(name => name, StringComparer.OrdinalIgnoreCase) .ToList(); }

Location detail

@Model.Location.LocationName

@Model.Location.LocationPath

Type

@(Model.Location.LocationTypeName ?? "Not set")

Parent

@(Model.Location.ParentLocationName ?? "Top level")

Description

@(Model.Location.Description ?? "No description yet.")

@if (TempData["LocationMessage"] is string locationMessage) {
@locationMessage
}

Known names

@foreach (var name in knownNames) { var isPreferred = string.Equals(name, Model.Location.LocationName, StringComparison.OrdinalIgnoreCase);
@name @if (isPreferred) { Preferred } else {
}
}

Child locations

@if (!Model.ChildLocations.Any()) {

No child locations yet.

} else {
@foreach (var child in Model.ChildLocations) { @child.LocationName }
}

Relationships

@if (!Model.Relationships.Any()) {

No relationships defined yet.

} else {
@foreach (var relationship in Model.Relationships) {
@relationship.FromLocationName @relationship.RelationshipTypeName.ToLowerInvariant() @relationship.ToLocationName @if (relationship.IsBidirectional) { both ways }

@relationship.Notes

}
}

Used here

Scenes

@foreach (var scene in Model.Scenes) {

@SceneLabel(scene.ChapterNumber, scene.SceneNumber) @scene.SceneTitle

} @if (!Model.Scenes.Any()) {

No scenes set here.

}

Characters

@foreach (var character in Model.Characters) {

@character.CharacterName @SceneLabel(character.ChapterNumber, character.SceneNumber)

} @if (!Model.Characters.Any()) {

No character placements yet.

}

Assets

@foreach (var asset in Model.Assets) {

@asset.AssetName @asset.Description

} @functions { private static string SceneLabel(decimal chapterNumber, decimal sceneNumber) => chapterNumber > 0 ? $"Chapter {chapterNumber:g}, Scene {sceneNumber:g}" : $"Scene {sceneNumber:g}"; } @if (!Model.Assets.Any()) {

No asset placements yet.

}