mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-22 09:22:24 +00:00
34 lines
1 KiB
C#
34 lines
1 KiB
C#
|
using System.Linq;
|
|||
|
using Dapper;
|
|||
|
|
|||
|
namespace FSO.Server.Database.DA.AuthTickets
|
|||
|
{
|
|||
|
public class SqlAuthTickets : AbstractSqlDA, IAuthTickets
|
|||
|
{
|
|||
|
public SqlAuthTickets(ISqlContext context) : base(context)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public void Create(AuthTicket ticket)
|
|||
|
{
|
|||
|
Context.Connection.Execute("INSERT INTO fso_auth_tickets VALUES (@ticket_id, @user_id, @date, @ip)", ticket);
|
|||
|
}
|
|||
|
|
|||
|
public void Delete(string id)
|
|||
|
{
|
|||
|
Context.Connection.Execute("DELETE FROM fso_auth_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id });
|
|||
|
}
|
|||
|
|
|||
|
public AuthTicket Get(string id)
|
|||
|
{
|
|||
|
return
|
|||
|
Context.Connection.Query<AuthTicket>("SELECT * FROM fso_auth_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id }).FirstOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
public void Purge(uint time)
|
|||
|
{
|
|||
|
Context.Connection.Execute("DELETE FROM fso_auth_tickets WHERE date < @time", new { time = time });
|
|||
|
}
|
|||
|
}
|
|||
|
}
|