0

I need to call a model + object in my table in view .. how can I add the variable TotalTime and insert it in my table?

This is my code :

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);

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
oussama_tr
  • 61
  • 7

1 Answers1

0

It's not exactly clear but if you just want to add TotalTime to every row in places you can do that like this:

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);
Vqf5mG96cSTT
  • 2,561
  • 3
  • 22
  • 41