From f4552cbccfe434b6bbca95ea1e343356cb9b0b03 Mon Sep 17 00:00:00 2001 From: snow flurry Date: Wed, 18 Oct 2023 10:23:26 -0700 Subject: [PATCH] BaseController: Fix add/edit action text --- PhoneToolMX/Controllers/BaseController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhoneToolMX/Controllers/BaseController.cs b/PhoneToolMX/Controllers/BaseController.cs index 09555d7..b7c5622 100644 --- a/PhoneToolMX/Controllers/BaseController.cs +++ b/PhoneToolMX/Controllers/BaseController.cs @@ -100,6 +100,7 @@ namespace PhoneToolMX.Controllers [HttpGet("New")] public async Task New() { + ViewData["Action"] = "add"; ViewData["Title"] = $"Add new {typeof(T).Name.ToLower()}"; return await FormView(default); } @@ -117,7 +118,7 @@ namespace PhoneToolMX.Controllers SetMessage( FormMessageType.Success, - $"{typeof(T).Name} {GetFriendlyName(vm)} was created." + $"{typeof(T).Name} {GetFriendlyName(new TViewModel().FromEntity(entity.Entity))} was created." ); return RedirectToAction("Edit", new { id = entity.Entity.Id }); @@ -144,6 +145,7 @@ namespace PhoneToolMX.Controllers [HttpGet("Edit")] public async Task Edit(int id) { + ViewData["Action"] = "update"; var model = _context.GetOwned(await CurrentUser()).FirstOrDefault(o => o.Id == id); if (model == null) return NotFound(); ViewData["Title"] = $"Editing {typeof(T).Name.ToLower()} {GetFriendlyName(new TViewModel().FromEntity(model))}";