Пример #1
0
 public IActionResult Trips()
 {
     try
     {
         var trips = _repository.GetAllTrips();
         return(View(trips));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get trips in Index page: {ex.Message}");
         return(Redirect("/error"));
     }
 }
 public IActionResult Get()
 {
     try
     {
         var results = _repository.GetAllTrips();
         return(Ok(Mapper.Map <IEnumerable <TripViewModel> >(results)));
     }
     catch (Exception ex)
     {
         //TODO Logging
         _logger.LogError($"Failed to Get all Trips: {ex}");
         return(BadRequest("Error occured"));
     }
 }