コード例 #1
0
 public void DeleteSession(tbSession theSession)
 {
     try
     {
         theSession.UpdateDateTime = DateTime.UtcNow;
         theSession.IsDeleted = true;
         _db.SaveChanges();
     }
     catch (DataException dex)
     {
         throw new ApplicationException("Data error!", dex);
     }
 }
コード例 #2
0
 public void UpdateSession(tbSession theSession)
 {
     try
     {
         theSession.Expiry.AddDays(1);
         theSession.UpdateDateTime = DateTime.UtcNow;
         _db.SaveChanges();
     }
     catch (DataException dex)
     {
         throw new ApplicationException("Data error!", dex);
     }
 }
コード例 #3
0
 public async Task DeleteSessionAsync(tbSession theSession)
 {
     try
     {
         theSession.UpdateDateTime = DateTime.UtcNow;
         theSession.IsDeleted = true;
         await _db.SaveChangesAsync();
     }
     catch (DataException dex)
     {
         throw new ApplicationException("Data error!", dex);
     }
 }
コード例 #4
0
        public async Task CreateNewSession(UserProfileDetails userPro, string IPAddress)
        {
            try
            {
                tbSession ses = new tbSession();
                ses.Id = Guid.NewGuid();
                ses.CreateDateTime = DateTime.UtcNow;
                ses.Expiry = DateTime.UtcNow.AddDays(1);
                ses.ProfileId = userPro.ProfileId;
                ses.IPAddress = IPAddress;

                _db.tbSessions.Add(ses);
                await _db.SaveChangesAsync();
            }
            catch (DataException dex)
            {
                throw new ApplicationException("Data error!", dex);
            }
        }