我需要在视图中调用我的表中的模型+对象..如何添加变量TotalTime
并将其插入到我的表中?
这是我的代码:
schoolinfo az = new schoolinfo();
var durer = 3;
var EstimationPrep = 20;
var TotalTime = durer * az.Location.Distance(point) + EstimationPrep;
var places = (from u in context.schoolinfo
orderby u.Location.Distance(point)
where u.Location.Distance(point) < DistanceMax
select u).Take(10);
var nearschools = places.ToList();
return View(nearschools);
由于
答案 0 :(得分:0)
它不完全清楚,但如果您只想将TotalTime添加到地方的每一行,您可以这样做:
var places = (from u in context.schoolinfo
orderby u.Location.Distance(point)
where u.Location.Distance(point) < DistanceMax
select new { u.column1, TotalTime }).Take(10);