データに対して何らかの計算を実行するコントローラーがあり、その計算をビューに返す必要があります。を通じてこれを達成できることは理解していますがViewBag
、これを行うためのベスト プラクティスを知りたいです。これらのLINQ
クエリは、で実行する必要があるものView
ですか?
public ViewResult Results()
{
var surveyresponsemodels = db.SurveyResponseModels.Include(
s => s.SurveyProgramModel).Include(s => s.PersonModel);
ViewBag.PatientFollowUpResult = db.SurveyResponseModels.Count(
r => r.PatientFollowUp);
ViewBag.ChangeCodingPractice = db.SurveyResponseModels.Count(
r => r.ChangeCodingPractice);
ViewBag.CountTotal = db.SurveyResponseModels.Count();
return View(surveyresponsemodels.ToList());
}