Esempio n. 1
0
 public IActionResult Get()
 {
     try
     {
         var results = _repository.GetAllTrips();
         return(Ok(Mapper.Map <IEnumerable <TripViewModel> >(results)));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get trips: {ex}");
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 2
0
        public IActionResult Index()
        {
            try
            {
                var data = _repository.GetAllTrips();

                return(View(data));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to get trips: {ex.Message}");
                return(Redirect("/error"));
            }
        }