c# - RedirectToAction 后返回调用方法
问题描述
我在不同的控制器中有两个动作,Action1 调用 Action2 视图。
有没有办法在几秒钟后返回 Action1 继续?
行动一:
//POST - CREATE
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(CreateEditInstitutionViewModel model)
{
//..........SOME CODE.............
_db.Request.Add(request);
await _db.SaveChangesAsync();
return RedirectToAction("ShowMessagePage", new RouteValueDictionary(new { Controller = "MessagePage", Action = "ShowMessagePage", myMsg = "heloo", i = true }));
//i want to comeback here to continue
return RedirectToAction(nameof(Index));
}
行动2:
public IActionResult ShowMessagePage(string myMsg,bool isDone)
{
if(isDone)
return View(new MessageViewModel { msg=myMsg}); // i want to go back to Action1
return NotFound();
}
解决方案
推荐阅读
- reactjs - 使用“valuePropName:'defaultValue'”时动态antd表单初始值设置问题
- javascript - 为什么即使在捕获错误之后 fetch 也会返回?
- node.js - 来自 Node.js 的 Microsoft Dynamics NAV '18 Web 服务的 NTLM 身份验证失败
- javascript - 如何使用jquery从两个表中删除匹配的记录
- javafx - 单击列表视图中的项目时,显示详细信息
- angular - 在 Angular 上初始化变量(包括 observables):构造函数、声明还是 ngOnInit?
- c# - 动态设置 Jquery 微调器最小值
- apache-flink - Flink,检查点的基本规则?
- openshift - 修改(和应用)OpenShift 模板时动态应用更改
- docker - Jenkins Docker 映像 - 仅将“作业”文件夹放入命名卷时的权限问题