我傳遞評價模型研究使用重定向到行動結果採取行動的數量。在結果動作控制器我想 執行LINQ語句中使用存儲庫檢索的行數和任何值posted.for例如Linq的語句返回行
number of rows = Select *
from table or model
where SmokesInHouse = SmokesInHouse And
SmokesInCar = SmokesInCar And
SmokesAtWork = SmokesAtWork'
public class SampleController : Controller
{
private IEnvRepository repository;
public SampleController(IEnvRepository assesmentRepository)
{
repository = assesmentRepository;
}
[HttpPost]
public ActionResult SmokingEnvironments(Assessment a)
{
if (ModelState.IsValid)
return RedirectToAction("Results", new { SmokesInHouse =SmokesInHouse, SmokesInCar = a.SmokesInCar, SmokesAtWork=a.SmokesAtWork });
}
return View(a);
}
[HttpGet]
public ActionResult Results()
{
return View();
}
}
'X.Where(P).Count之間()'相當於'X.Count(P)'。 – 2013-05-06 18:51:29