Telegram bot for shy people
https://t.me/MutualSympathyBot
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
644 B
27 lines
644 B
4 years ago
|
#load "UserEntity.csx"
|
||
|
|
||
|
using Microsoft.WindowsAzure.Storage;
|
||
|
using Microsoft.WindowsAzure.Storage.Table;
|
||
|
|
||
|
public class UsersRepository
|
||
|
{
|
||
|
private CloudTable UsersTable { get; }
|
||
|
|
||
|
public UsersRepository(CloudTable usersTable)
|
||
|
{
|
||
|
this.UsersTable = usersTable;
|
||
|
}
|
||
|
|
||
|
public async Task AddUser(UserEntity entity)
|
||
|
{
|
||
|
var insertOperation = TableOperation.InsertOrReplace(entity);
|
||
|
await this.UsersTable.ExecuteAsync(insertOperation);
|
||
|
}
|
||
|
|
||
|
public UserEntity[] GetAllUsers()
|
||
|
{
|
||
|
var result = this.UsersTable.ExecuteQuery(new TableQuery<UserEntity>());
|
||
|
return result.ToArray();
|
||
|
}
|
||
|
}
|