示例#1
0
 public static DrinkEventEntity ToEntity(this Domain.DrinkEvent drinkEvent)
 {
     return(new DrinkEventEntity()
     {
         StartUtc = drinkEvent.StartUtc,
         EndUtc = drinkEvent.EndUtc
     });
 }
        public async Task <Domain.DrinkEvent> CreateDrinkEventAsync(DateTime startTime, DateTime endTime)
        {
            var drinkEvent = new Domain.DrinkEvent(startTime, endTime);

            await this.storageAccessService.InsertAsync(TableNames.DrinkEvents, new JsonTableEntity <DrinkEventEntity>(StaticPartitionKeys.DrinkEvent, GetRowKey(endTime), drinkEvent.ToEntity()));

            return(drinkEvent);
        }
示例#3
0
 public static DrinkEventDTO ToDto(this Domain.DrinkEvent drinkEvent)
 {
     return(new DrinkEventDTO()
     {
         StartUtc = drinkEvent.StartUtc,
         EndUtc = drinkEvent.EndUtc,
         ScoringUserIds = drinkEvent.ScoringUserIds
     });
 }
        public async Task UpdateDrinkEventAsync(Domain.DrinkEvent drinkEvent)
        {
            string rowKey = GetRowKey(drinkEvent.EndUtc);

            var entity = await storageAccessService.GetTableEntityAsync <JsonTableEntity <DrinkEventEntity> >(TableNames.DrinkEvents, StaticPartitionKeys.DrinkEvent, rowKey);

            entity.Entity = drinkEvent.ToEntity();

            await storageAccessService.ReplaceAsync(TableNames.DrinkEvents, entity);
        }