示例#1
0
 public IActionResult UpdateReportCandidat([FromBody] Report report)
 {
     try{
         checkReport(report);
         IsqlMethod isql = Factory.Factory.GetSQLInstance("mysql");
         isql.UserCanUpdate(report.sessionId);
         int idCandidat = isql.getIdFromCandidateEmail(report.emailCandidat);
         if (!isql.reportAlreadyExist(idCandidat))
         {
             throw new Exception("Le report n'existe pas, vous devez le creer au prealable");
         }
         isql.updateReport(report, idCandidat);
         return(new ObjectResult(new State()
         {
             code = 3, content = "Le report a ete modifie parfaitement à votre system", success = true
         }));
     }catch (Exception exc) {
         new WsCustomeException(this.GetType().Name, exc.Message);
         State state = new State()
         {
             code = 1, content = exc.Message, success = false
         };
         return(CreatedAtRoute("GetNote", new { error = state }, state));
     }
 }
示例#2
0
 public IActionResult updateCandidat([FromBody] Candidat candidat)
 {
     try{
         checkCandidat(candidat);
         IsqlMethod isql = Factory.Factory.GetSQLInstance("mysql");
         isql.UserCanUpdate(candidat.session_id);
         if (!isql.CandidatAlreadyExist(candidat))
         {
             throw new Exception("Le candidat n'est pas existant dans votre systeme, veuillez le creer");
         }
         int idUser     = isql.getIdFromToken(candidat.session_id);
         int idCandidat = isql.getIdFromCandidateEmail(candidat.emailAdress);
         isql.updateCandidate(candidat, idUser);
         isql.typeAction(candidat.action, candidat.independant, DateTime.Now, idCandidat, "UPDATE");
         return(new ObjectResult(new State()
         {
             code = 4, content = "Le candidat a ete modifie dans votre systeme", success = true
         }));
     }catch (Exception exc) {
         new WsCustomeException(this.GetType().Name, exc.Message);
         State state = new State()
         {
             code = 1, content = exc.Message, success = false
         };
         return(CreatedAtRoute("GetNote", new { error = state }, state));
     }
 }