コード例 #1
0
ファイル: Session.cs プロジェクト: offal-dev/offal-bot
 public Session(SessionDao dao)
 {
     Id            = dao.PartitionKey;
     Expiry        = dao.Expiry;
     Username      = dao.Username;
     Organisations = JsonConvert.DeserializeObject <List <SessionDao.Organisation> >(dao.Organisations);
 }
コード例 #2
0
ファイル: GithubLogin.cs プロジェクト: offal-dev/offal-bot
        private static SessionDao CreateSessionObject(
            IEnumerable <Organization> orgs,
            Account user)
        {
            var sessionId     = Guid.NewGuid().ToString();
            var organisations = orgs.Select(x => new SessionDao.Organisation {
                Id = x.Id, Name = x.Login
            });
            var organisationsSerialised = JsonConvert.SerializeObject(organisations);
            var session = new SessionDao
            {
                PartitionKey  = sessionId,
                RowKey        = sessionId,
                Timestamp     = DateTimeOffset.Now,
                Organisations = organisationsSerialised,
                Username      = user.Login,
                Expiry        = DateTimeOffset.Now.AddHours(8)
            };

            return(session);
        }