public async Task <IWinnerData> GetAsync(string projectId, string userId) { var partitionKey = WinnerEntity.GeneratePartitionKey(projectId); var rowKey = WinnerEntity.GenerateRowKey(userId); return(await _winnersStorage.GetDataAsync(partitionKey, rowKey)); }
public async Task DeleteAsync(string projectId, string userId) { var partitionKey = WinnerEntity.GeneratePartitionKey(projectId); var rowKey = WinnerEntity.GenerateRowKey(userId); await _winnersStorage.DeleteAsync(partitionKey, rowKey); }
public Task UpdateAsync(IWinnerData winnerData) { var partitionKey = WinnerEntity.GeneratePartitionKey(winnerData.ProjectId); var rowKey = WinnerEntity.GenerateRowKey(winnerData.WinnerId); return(_winnersStorage.ReplaceAsync(partitionKey, rowKey, itm => { itm.Update(winnerData); return itm; })); }
public static WinnerEntity Create(IWinnerData src) { var result = new WinnerEntity { PartitionKey = GeneratePartitionKey(src.ProjectId), RowKey = GenerateRowKey(src.WinnerId), FullName = src.FullName, Place = src.Place, Result = src.Result, Votes = src.Votes, Score = src.Score, Budget = src.Budget }; return(result); }
public async Task <IEnumerable <IWinnerData> > GetWinnersAsync(string projectId) { var partitionKey = WinnerEntity.GeneratePartitionKey(projectId); return(await _winnersStorage.GetDataAsync(partitionKey)); }
public async Task SaveAsync(IWinnerData winnerData) { var newEntity = WinnerEntity.Create(winnerData); await _winnersStorage.InsertAsync(newEntity); }