public IActionResult GetAllByUser(string userName) { IActionResult result = Unauthorized(); try { var visits = _db.GetVisitsByUser(userName); var visitArr = visits.Select(x => MapToDTO(x)).ToArray(); result = Ok(visitArr); } catch (Exception) { result = BadRequest(new { Message = "Failed to get current visit" }); } return(result); }