BaseController: Fix add/edit action text
This commit is contained in:
parent
f7bca00ec4
commit
f4552cbccf
|
@ -100,6 +100,7 @@ namespace PhoneToolMX.Controllers
|
|||
[HttpGet("New")]
|
||||
public async Task<IActionResult> 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<IActionResult> Edit(int id)
|
||||
{
|
||||
ViewData["Action"] = "update";
|
||||
var model = _context.GetOwned<T>(await CurrentUser()).FirstOrDefault(o => o.Id == id);
|
||||
if (model == null) return NotFound();
|
||||
ViewData["Title"] = $"Editing {typeof(T).Name.ToLower()} {GetFriendlyName(new TViewModel().FromEntity(model))}";
|
||||
|
|
Loading…
Reference in a new issue