Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public async Task DeleteAsync(string projectId, string userId)
        {
            var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);
            var rowKey       = WinnerEntity.GenerateRowKey(userId);

            await _winnersStorage.DeleteAsync(partitionKey, rowKey);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 5
0
        public async Task <IEnumerable <IWinnerData> > GetWinnersAsync(string projectId)
        {
            var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);

            return(await _winnersStorage.GetDataAsync(partitionKey));
        }
Esempio n. 6
0
 public async Task SaveAsync(IWinnerData winnerData)
 {
     var newEntity = WinnerEntity.Create(winnerData);
     await _winnersStorage.InsertAsync(newEntity);
 }