예제 #1
0
 public AdminService(StorageAccessService storageAccessService, IContestResultRepository contestResultRepository, IAdminRepository adminRepository,
                     IContestRepository contestRepository, INotificationService notificationService)
 {
     StorageAccessService    = storageAccessService ?? throw new ArgumentNullException(nameof(storageAccessService));
     ContestResultRepository = contestResultRepository ?? throw new ArgumentNullException(nameof(contestResultRepository));
     AdminRepository         = adminRepository ?? throw new ArgumentNullException(nameof(adminRepository));
     ContestRepository       = contestRepository ?? throw new ArgumentNullException(nameof(contestRepository));
     NotificationService     = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
 }
예제 #2
0
        public async Task StartContestAsync(Guid contestId)
        {
            var entity = await StorageAccessService.GetTableEntityAsync <JsonTableEntity <BeerContestModel> >(TableName, contestId.ToString(), contestId.ToString());

            entity.Entity.State = BeerContestState.InProgress;

            var            table     = StorageAccessService.GetTableReference(TableName);
            TableOperation operation = TableOperation.Replace(entity);
            await table.ExecuteAsync(operation);
        }
예제 #3
0
        public async Task <Guid> CreateContestAsync(BeerContestModel contest)
        {
            Guid contestId = Guid.NewGuid();

            contest.Id = contestId;
            var entity = new JsonTableEntity <BeerContestModel>(contestId.ToString(), contestId.ToString(), contest);
            var table  = StorageAccessService.GetTableReference(TableName);

            TableOperation operation = TableOperation.Insert(entity);
            await table.ExecuteAsync(operation);

            return(contestId);
        }
예제 #4
0
 public ContestResultRepository(StorageAccessService storageAccessService)
 {
     this.StorageAccessService = storageAccessService ?? throw new ArgumentNullException(nameof(storageAccessService));
 }
예제 #5
0
 public Task <string> UploadBeerImageAsync(string extension, Stream imageStream)
 {
     return(StorageAccessService.SaveFileInBlobStorage("img", "beers", extension, imageStream));
 }
예제 #6
0
 public async Task UpdateContestEntityAsync(JsonTableEntity <BeerContestModel> entity)
 {
     var            table     = StorageAccessService.GetTableReference(TableName);
     TableOperation operation = TableOperation.Replace(entity);
     await table.ExecuteAsync(operation);
 }
예제 #7
0
        public async Task <JsonTableEntity <BeerContestModel> > GetContestDefinitionEntityAsync(Guid contestId)
        {
            var entity = await StorageAccessService.GetTableEntityAsync <JsonTableEntity <BeerContestModel> >(TableName, contestId.ToString(), contestId.ToString());

            return(entity);
        }
예제 #8
0
 public AdminRepository(StorageAccessService storageAccessService, IContestRepository contestRepository)
 {
     this.StorageAccessService = storageAccessService ?? throw new ArgumentNullException(nameof(storageAccessService));
     this.ContestRepository    = contestRepository ?? throw new ArgumentNullException(nameof(contestRepository));
 }