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)); } }
// GET api/truck public IEnumerable <TruckViewModel> Get() { return(_truckService.GetTrucks()); }