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); }
public async Task UpsertUser(User user) { await _Client.UpsertDocumentAsync(UriFactory.CreateDocumentCollectionUri("pxdraw", "users"), user); }