示例#1
0
 public ActionResult Details(TruckFindViewModel trucksvm)
 {
     try
     {
         List <TruckModel> trucks = _truckService.GetTrucks();
         var trucksToDisplay      = trucks.Where(x => x.Couleur.ToLower() == trucksvm.couleur.ToLower()).ToList();
         trucksvm.Trucks = trucksToDisplay;
         foreach (var truck in trucksvm.Trucks)
         {
             truck.DerniereGeo = truck.GpsCoords.OrderByDescending(x => x.date).FirstOrDefault();
         }
         return(View(trucksvm));
     }
     catch (Exception)
     {
         return(View(trucksvm));
     }
 }
示例#2
0
 // GET api/truck
 public IEnumerable <TruckViewModel> Get()
 {
     return(_truckService.GetTrucks());
 }