示例#1
0
        public async Task <User> GetOrCreateUser(string UserId)
        {
            User user;

            try
            {
                user = await GetUser(UserId);
            }
            catch
            {
                user = new User
                {
                    Id         = UserId,
                    LastInsert = DateTime.UtcNow.AddDays(-1),
                };
                var response = await _Client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("pxdraw", "users"), user);
            }
            return(user);
        }
示例#2
0
 public async Task UpsertUser(User user)
 {
     await _Client.UpsertDocumentAsync(UriFactory.CreateDocumentCollectionUri("pxdraw", "users"), user);
 }