Пример #1
0
 public IActionResult Trips()
 {
     try
     {
         var trips = _repository.GetTripsByUserName(this.User.Identity.Name);
         return(View(trips));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get trips in Trips page: { ex.Message}");
         return(Redirect("/error"));
     }
 }
Пример #2
0
 public IActionResult Get()
 {
     try
     {
         var result = _repository.GetTripsByUserName(this.User.Identity.Name);
         return(Ok(Mapper.Map <IEnumerable <TripViewModel> >(result)));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get ll trips: {ex}");
         return(BadRequest("Error occured"));
     }
     //if (true) return BadRequest("something went wrong");
 }