当用户提交表单时,我运行了业务逻辑。如;
.
.
.
//some process
if(model.UserName == "foo")
{
//some process
}
if(model.City != "Istanbul")
{
//Alert user; Are you sure you want to continue bla bla bla...
//Then user click if 'yes' some process else some process
}
我想,将对象保留在会话中并显示 javascript 确认消息。如果用户单击“是”或“否”,我将创建隐藏输入匹配 viewModel 的属性并设置输入值用户的选择。然后自动提交表单。但我又想了想,这样不好。什么是最佳实践?