MVC新手在這裏。MVC +如何在控制器動作之前提醒用戶
我想控制器動作之前用戶確認(更新記錄)
我的代碼:
[HttpPost]
public ActionResult JobHandlerUpdate(int jobScheduleId, JobHandlerList jobHandlerList)
{
var updateJobHander = new MainJobHandler();
var item = updateJobHander.GetById(jobScheduleId);
if (ModelState.IsValid)
{
List<string> days = jobHandlerList.JobProcessDayOfWeek.Split(',').ToList();
updateJobHander.Update(item, days);
if(jobHandlerList.MaxInstances == 0)
{
// here I need to prompt user if maxInstances entered is Zero-
Job will be disabled want to processs (Y/N) if yes update
else do nothing or redirect to edit screen
}
return RedirectToAction("JobHandler");
}
return View(item);
}
我是否需要使用JavaScript警惕呢? 還是有一個好方法。
CGK - 你可以把控制器操作的一些示例這確實cofimation請。 – Sreedhar 2010-12-02 00:35:03