Exemplo n.º 1
0
        public async Task UpdateAsync(GmailUserDataDTO gmailUserData)
        {
            var userData = await this.context.GmailUserData.FirstOrDefaultAsync();

            userData.AccessToken = gmailUserData.AccessToken;
            userData.ExpiresAt   = DateTime.Now.AddSeconds(gmailUserData.ExpiresInSec);
            //userData.Seal();
            this.context.Attach(userData).State = EntityState.Modified;
            await this.context.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task CreateAsync(GmailUserDataDTO gmailUserData)
        {
            GmailUserData userData = new GmailUserData
            {
                AccessToken  = gmailUserData.AccessToken,
                RefreshToken = gmailUserData.RefreshToken,
                ExpiresAt    = DateTime.Now.AddSeconds(gmailUserData.ExpiresInSec)
            };

            //userData.Seal();
            await this.context.GmailUserData.AddAsync(userData);

            await this.context.SaveChangesAsync();
        }