コード例 #1
0
ファイル: SqlElections.cs プロジェクト: LinSianTing/FreeSO
 public bool CreateCandidate(DbElectionCandidate candidate)
 {
     try
     {
         var result = Context.Connection.Execute("INSERT INTO fso_election_candidates (election_cycle_id, candidate_avatar_id, comment) "
                                                 + "VALUES (@election_cycle_id, @candidate_avatar_id, @comment)", candidate);
         return(result > 0);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #2
0
ファイル: SqlElections.cs プロジェクト: LinSianTing/FreeSO
 public bool SetCandidateState(DbElectionCandidate candidate)
 {
     try
     {
         var result = Context.Connection.Execute("UPDATE fso_election_candidates SET state = @state, comment = @comment " +
                                                 "WHERE election_cycle_id = @election_cycle_id AND candidate_avatar_id = @candidate_avatar_id"
                                                 , new { state = candidate.state.ToString(), candidate.comment,
                                                         candidate.election_cycle_id, candidate.candidate_avatar_id });
         return(result > 0);
     }
     catch (Exception)
     {
         return(false);
     }
 }