diff --git a/PlotLine/Controllers/ScenesController.cs b/PlotLine/Controllers/ScenesController.cs
index 4d9e93bd..b026b0ee 100644
--- a/PlotLine/Controllers/ScenesController.cs
+++ b/PlotLine/Controllers/ScenesController.cs
@@ -967,10 +967,27 @@ public sealed class ScenesController(
[HttpPost]
[ValidateAntiForgeryToken]
- public async Task AddAssetCustodyEvent(AssetCustodyCreateViewModel model)
+ public async Task AddAssetCustodyEvent(AssetCustodyCreateViewModel newAssetCustodyEvent)
{
+ var model = newAssetCustodyEvent;
+ var scene = await scenes.GetEditAsync(model.SceneID);
+ if (scene is null)
+ {
+ return NotFound();
+ }
+
+ if (!ModelState.IsValid
+ || !scene.AssetOptions.Any(option => option.Value == model.StoryAssetID.ToString())
+ || !scene.AssetCustodyEventTypeOptions.Any(option => option.Value == model.AssetCustodyEventTypeID.ToString())
+ || !scene.CustodyRoleOptions.Any(option => option.Value == model.CustodyRoleID.ToString())
+ || model.CustodianCharacterIds.Any(id => !scene.CharacterOptions.Any(option => option.Value == id.ToString())))
+ {
+ return BadRequest("Choose a project asset, custody event type, role and valid custodians.");
+ }
+
await assets.AddCustodyEventAsync(model);
if (savedData is not null) await savedData.Scene(model.SceneID, "assets");
+ TempData["SceneCustodySaved"] = "Custody saved.";
return RedirectForScene(model.SceneID, model.ReturnProjectID, model.ReturnBookID);
}
diff --git a/PlotLine/Views/Shared/SceneInspectorV2/_SceneWorldCard.cshtml b/PlotLine/Views/Shared/SceneInspectorV2/_SceneWorldCard.cshtml
index 8f3e3aa1..3161ddca 100644
--- a/PlotLine/Views/Shared/SceneInspectorV2/_SceneWorldCard.cshtml
+++ b/PlotLine/Views/Shared/SceneInspectorV2/_SceneWorldCard.cshtml
@@ -28,7 +28,7 @@
@@ -76,6 +76,45 @@
@Model.SceneAssetLocations.Count placed asset@(Model.SceneAssetLocations.Count == 1 ? "" : "s").
}
+
+ Record custody
+
+
+ @if (TempData["SceneCustodySaved"] is string message)
+ {
+ @message
+ }
+
Asset events
@foreach (var item in Model.AssetEvents)