internal static SessionBLL CreateNewSession(SiteBLL site, UserBLL user) { using (var context = new AuctionSiteContext(site.ConnectionString)) { var session = new Session { Id = CreateSessionId(site, user), ValidUntil = site.AlarmClock.Now.AddSeconds(site.SessionExpirationInSeconds), }; context.Sessions.Add(session); context.SaveChanges(); return(new SessionBLL(session, user)); } }
private const int ITERATIONS = 1000; // number of pbkdf2 iterations public static bool SiteNameAlreadyExists(AuctionSiteContext context, string name) { return(context.Sites.Any(site => site.Name == name)); }