Ejemplo n.º 1
0
 public bool TryRegisterMail(DbElectionCycleMail p)
 {
     try
     {
         return(Context.Connection.Execute("INSERT INTO fso_election_cyclemail (cycle_id, avatar_id, cycle_state) VALUES (@cycle_id, @avatar_id, @cycle_state)",
                                           new { p.avatar_id, p.cycle_id, cycle_state = p.cycle_state.ToString() }) > 0);
     }
     catch
     {
         //already exists, or foreign key fails
         return(false);
     }
 }
Ejemplo n.º 2
0
 public bool EmailRegistered(DbElectionCycleMail p)
 {
     return(Context.Connection.Query <int>("SELECT count(*) FROM fso_election_cyclemail WHERE cycle_id = @cycle_id AND avatar_id = @avatar_id AND cycle_state = @cycle_state",
                                           new { p.avatar_id, p.cycle_id, cycle_state = p.cycle_state.ToString() }).First() > 0);
 }