public async Task <bool> UserExists(string id) { string partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); string rowKey = BackOfficeUserEntity.GenerateRowKey(id); return(await _tableStorage.GetDataAsync(partitionKey, rowKey) != null); }
public Task ChangePasswordAsync(string id, string newPassword) { string partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); string rowKey = BackOfficeUserEntity.GenerateRowKey(id); return(_tableStorage.ReplaceAsync(partitionKey, rowKey, itm => { itm.SetPassword(newPassword); return itm; })); }
public Task UpdateAsync(IBackOfficeUser backOfficeUser) { string partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); string rowKey = BackOfficeUserEntity.GenerateRowKey(backOfficeUser.Id); return(_tableStorage.MergeAsync(partitionKey, rowKey, entity => { entity.Edit(backOfficeUser); return entity; })); }
public async Task <IBackOfficeUser> GetAsync(string id) { if (id == null) { return(null); } string partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); string rowKey = BackOfficeUserEntity.GenerateRowKey(id); return(await _tableStorage.GetDataAsync(partitionKey, rowKey)); }
public async Task <IBackOfficeUser> AuthenticateAsync(string username, string password) { if (username == null || password == null) { return(null); } string partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); string rowKey = BackOfficeUserEntity.GenerateRowKey(username); BackOfficeUserEntity entity = await _tableStorage.GetDataAsync(partitionKey, rowKey); return(entity == null ? null : (entity.CheckPassword(password) ? entity : null)); }
public async Task <IEnumerable <IBackOfficeUser> > GetAllAsync() { string partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); return(await _tableStorage.GetDataAsync(partitionKey)); }