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.
 
 
MutualSympathyBot/messages/UsersRepository.csx

26 lines
644 B

#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();
}
}