public CandidateKeyword Post([FromBody] CandidateKeyword model) { // POST: api/User // this post method insert the new row or update the current row if there is a record with same ID CandidateKeywordDE de = new CandidateKeywordDE(); CandidateKeyword sonuc = de.AddCandidateKeyword(model); return(sonuc); }
public IEnumerable <CandidateKeyword> Get(int kid, int cid) { // GET: api/CandidateKeyword //HttpContext.RiseError(new InvalidOperationException("Test")); CandidateKeyword model = new CandidateKeyword(); CandidateKeywordDE de = new CandidateKeywordDE(); return(de.GetCandidateKeyword(kid, cid)); }
public IActionResult Delete([FromBody] CandidateKeyword model) { // DELETE: api/ApiWithActions/5 CandidateKeywordDE de = new CandidateKeywordDE(); bool sonuc = de.DeleteCandidateKeyword(model); if (sonuc) { return(Ok()); } else { return(NotFound()); } }
public IActionResult Put([FromBody] CandidateKeyword model) { // POST: api/CandidateKeyword // this post method insert the new row or update the current row if there is a record with same ID CandidateKeywordDE de = new CandidateKeywordDE(); bool sonuc = de.UpdateCandidateKeyword(model); if (sonuc) { return(Ok()); } else { return(NotFound()); } }
public bool DeleteCandidateKeyword(CandidateKeyword ck) { if (ck != null) { var paramu = new { CandidateID = ck.Candidate.CandidateID, KeywordID = ck.Keyword.KeywordID }; using (IDbConnection cnn = new SqlConnection(Helper.GetConnectionString())) { string sql = "dbo.SP_CandidateKeywordDELETE"; int affectedRow = int.Parse(cnn.ExecuteScalar(sql, paramu, commandType: CommandType.StoredProcedure).ToString()); return(affectedRow > 0 ? true : false); } } else { return(false); } }
public bool UpdateCandidateKeyword(CandidateKeyword comp) { if (comp != null) { var paramu = new { KeywordID = comp.Keyword.KeywordID, CandidateID = comp.Candidate.CandidateID, Grade = comp.Grade }; using (IDbConnection cnn = new SqlConnection(Helper.GetConnectionString())) { string sql = "dbo.SP_CandidateKeywordUpdate"; int affectedRow = int.Parse(cnn.ExecuteScalar(sql, paramu, commandType: CommandType.StoredProcedure).ToString()); return(affectedRow > 0 ? true : false); } } else { return(false); } }
public CandidateKeyword AddCandidateKeyword(CandidateKeyword comp) { if (comp != null) { var paramu = new { KeywordID = comp.Keyword.KeywordID, CandidateID = comp.Candidate.CandidateID, Grade = comp.Grade }; using (IDbConnection cnn = new SqlConnection(Helper.GetConnectionString())) { string sql = "dbo.SP_CandidateKeywordSET"; CandidateKeyword us = cnn.QuerySingle <CandidateKeyword>(sql, paramu, commandType: CommandType.StoredProcedure); return(us); } } else { return(null); } }