Example #1
0
 public IActionResult GetAgentDetails(int id)
 {
     try
     {
         var agent       = serviceAgent.GetAgentDetaillsResource(id);
         var agentResult = mapper.Map <AgentResource>(agent);
         var s           = serviceSeance.GetSenacesByAgentId(id);
         var seances     = mapper.Map <IEnumerable <Seance>, ICollection <SeanceAgentResource> >(s);
         var vehicule    = mapper.Map <ICollection <Agent_VehiculeResource> >(agent.Vehicules);
         return(Ok(new { agentResult, seances, vehicule }));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }