public IActionResult Get()
 {
     try
     {
         var results = _repo.GetAllTrips();
         return(Ok(Mapper.Map <IEnumerable <TripViewModel> >(results)));
     }
     catch (Exception ex)
     {
         return(BadRequest($"Error from GET: {ex}"));
     }
 }
Example #2
0
 public IActionResult Index()
 {
     try
     {
         var data = _repo.GetAllTrips();
         return(View(data));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get trips in Index page: {ex.Message}");
         return(Redirect("/error"));
     }
 }