Esempio n. 1
0
        public Task OpenSession(HttpRequest request, IPrincipal user)
        {
            //КОСТЫЛЬ
            lock (syncSubmit)
            {

                var log = new SessionLog
                {
                    UserId = user.Identity.GetUserId(),
                    Ip4 = request.UserHostAddress,
                    OpenDateTime = DateTime.Now
                };
                var tmp = db.SessionLogs.ToList();
                var other = tmp.LastOrDefault(x => x.UserId == log.UserId && x.Ip4 == log.Ip4);
                if (other != null && (log.UserId == other.UserId || log.OpenDateTime < other.OpenDateTime.AddMinutes(30)))
                    return null;
                return Task.Run(() =>
                {
                    lock (syncSubmit) db.SessionLogs.InsertOnSubmit(log);
                    Submit();
                });
            }
        }
Esempio n. 2
0
 partial void UpdateSessionLog(SessionLog instance);
Esempio n. 3
0
 partial void DeleteSessionLog(SessionLog instance);
Esempio n. 4
0
 partial void InsertSessionLog(SessionLog instance);