public HttpResponseMessage Post([Bind(Exclude = "Id")][FromBody] List <CandidateTechnologyExcludeDTO> list)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CandidateTechnologyRepository rep = new CandidateTechnologyRepository();
             foreach (CandidateTechnologyExcludeDTO entity in list)
             {
                 CandidateTechnology ent = new CandidateTechnology {
                     Id = 0, IdCandidate = entity.IdCandidate, IdTechnology = entity.IdTechnology
                 };
                 if (entity.Delete)
                 {
                     rep.DeleteByCandidate(ent);
                 }
                 else
                 {
                     rep.Insert(ent);
                 }
             }
             return(Request.CreateResponse(HttpStatusCode.OK, "Operação efetuada com sucesso!"));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
 public HttpResponseMessage Put([FromBody] CandidateTechnology entity)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CandidateTechnologyRepository rep = new CandidateTechnologyRepository();
             rep.Update(entity);
             return(Request.CreateResponse(HttpStatusCode.OK, "Operação efetuada com sucesso!"));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
        public void Update(CandidateTechnology entity)
        {
            string query = "UPDATE " + TableName + " SET IdCandidate = " + entity.IdCandidate + ", IdTechnology = " + entity.IdTechnology + " WHERE Id = " + entity.Id;

            ExecuteCommand(query);
        }
        public void DeleteByCandidate(CandidateTechnology entity)
        {
            string query = "DELETE FROM " + TableName + " WHERE IdCandidate = " + entity.IdCandidate + " AND IdTechnology = " + entity.IdTechnology;

            ExecuteCommand(query);
        }
        public void Insert(CandidateTechnology entity)
        {
            string query = "INSERT INTO " + TableName + " (IdCandidate, IdTechnology) VALUES (" + entity.IdCandidate + ", " + entity.IdTechnology + ")";

            ExecuteCommand(query);
        }