public IActionResult Get() { try { _logger.LogInformation("Trying to get list of volunteers"); var volunteers = _volunteersService.Get().ToList(); _logger.LogInformation($"Search completed. Found {volunteers.Count} volunteers."); VolunteersResponse.NumberOfRecordsFound = volunteers.Count; VolunteersResponse.Data = volunteers; VolunteersResponse.Message = "Search completed."; return(Ok(new[] { VolunteersResponse })); } catch (Exception ex) { _logger.LogInformation($"Error: {ex.Message}"); } _logger.LogError("Bad request"); return(BadRequest()); }
public Volunteer Get(long id) { return(volunteerService.Get(id)); }