【发布时间】:2017-05-12 09:35:51
【问题描述】:
我正在尝试通过在我的控制器中使用 inline if 从数据库中的一张表中获取金额
public ActionResult IfPaid(int id)
{
Ref_ViewModel = new View_model.View_Model();
Ref_ViewModel.GetAllCustomers(id).Any(p => p.Paid == false) ? RedirectToAction("Pay", "Account") : RedirectToAction("Download");
}
我在最后一行得到这个错误
只有赋值、调用、递增、递减和新对象表达式可以用作语句
我们如何解决这个问题?
【问题讨论】:
-
请注意,model-view-controller 标签是针对有关模式的问题。 ASP.NET-MVC 实现有一个特定的标签。
标签: c# asp.net-mvc compiler-errors controller