lia*_*iam 14 asp.net redirecttoaction asp.net-mvc-2
我在尝试使用RedirectToAction时收到此错误,任何人都可以提供有关为什么会发生这种情况的任何建议,我之前使用过这个没有任何问题,我一定是缺少一些东西.
无法将类型'System.Web.Mvc.RedirectToRouteResult'隐式转换为'System.Web.Mvc.ViewResult'
[HttpPost]
public ViewResult Edit(Customer customer)
{
if (ModelState.IsValid)
{
customersRepository.SaveCustomer(customer);
TempData["message"] = customer.CustomerName + " has been saved.";
return RedirectToAction("Index");
}
else //validation error, so redisplay the same view
return View(customer);
}
Run Code Online (Sandbox Code Playgroud)
问候
利亚姆
| 归档时间: |
|
| 查看次数: |
9805 次 |
| 最近记录: |