示例#1
0
 public IActionResult Trips()
 {
     try
     {
         var data = _repository.GetTripsByUsername(User.Identity.Name);
         return(View(data));
     }
     catch (Exception e)
     {
         _logger.LogError($"Failed to get trips in Index page:   {e.Message}");
         return(new AcceptedResult());
     }
 }
示例#2
0
        public IActionResult Get()
        {
            try
            {
                var allTrips = _repository.GetTripsByUsername(User.Identity.Name);

                return(Ok(_mapper.Map <IEnumerable <TripViewModel> >(allTrips)));
            }
            catch (Exception e)
            {
                _logger.LogError($"Failed to get All Trips: {e.Message}");
                return(BadRequest($"TripsController Get: {e.Message}"));
            }
        }