Hello,
I would like to return messages to the client whenever a grid create or edit action has completed successfully. I have tried adding to the Json being returned and using VeiwData/TempData but neither is a viable option with the ToDataSourceResult of the grid action methods. I can't seem to find any documentation on how I can achieve this. Please point me in the right direction. Below is an action method I converted from being a grid action to using my own modal editing but I'd like to use the built in grid popup instead.
[HttpPost]
public IActionResult Update([DataSourceRequest] DataSourceRequest request, CaseRequestVM vm, bool fromDashboard = false)
{
if (ModelState.IsValid)
{
bool caseRequestUpdated = _caseRequestService.UpdateCaseRequest(vm);
if (caseRequestUpdated)
{
TempData["Message"] = "Case request updated."; // ===> SHOW ON CLIENT
}
else
{
TempData["Message"] = "Failed to update case request";
}
}
else
{
TempData["Message"] = "Failed to update case request";
}
if (!fromDashboard)
return RedirectToAction(nameof(Index));
else
return RedirectToAction("Dashboard", "Home");
}