Exemple #1
0
 public IActionResult GetSeanceByCandidate(int id)
 {
     try
     {
         var seances       = serviceSeance.GetSeancesByCandidateId(id);
         var seancesResult = mapper.Map <IEnumerable <SeanceCandidateResource> >(seances);
         return(Ok(seancesResult));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Exemple #2
0
        public IActionResult GetCandidatDetails(int id)
        {
            try
            {
                var candidat         = serviceCandidat.GetCandidat(id);
                var seance           = serviceSeance.GetSeancesByCandidateId(id);
                var candidatResource = mapper.Map <CandidatResource>(candidat);
                var seances          = mapper.Map <IEnumerable <SeanceCandidateResource> >(seance);

                return(Ok(new { candidatResource, seances }));
            }
            catch (Exception)
            {
                return(StatusCode(500, "Internal Server Error"));
            }
        }