public IActionResult GetAllAgents() { try { var agents = serviceAgent.GetAgents(); var agentResource = mapper.Map <IEnumerable <AgentResource> >(agents); return(Ok(agentResource)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }