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)); }
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); }
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); }
public ContestResultRepository(StorageAccessService storageAccessService) { this.StorageAccessService = storageAccessService ?? throw new ArgumentNullException(nameof(storageAccessService)); }
public Task <string> UploadBeerImageAsync(string extension, Stream imageStream) { return(StorageAccessService.SaveFileInBlobStorage("img", "beers", extension, imageStream)); }
public async Task UpdateContestEntityAsync(JsonTableEntity <BeerContestModel> entity) { var table = StorageAccessService.GetTableReference(TableName); TableOperation operation = TableOperation.Replace(entity); await table.ExecuteAsync(operation); }
public async Task <JsonTableEntity <BeerContestModel> > GetContestDefinitionEntityAsync(Guid contestId) { var entity = await StorageAccessService.GetTableEntityAsync <JsonTableEntity <BeerContestModel> >(TableName, contestId.ToString(), contestId.ToString()); return(entity); }
public AdminRepository(StorageAccessService storageAccessService, IContestRepository contestRepository) { this.StorageAccessService = storageAccessService ?? throw new ArgumentNullException(nameof(storageAccessService)); this.ContestRepository = contestRepository ?? throw new ArgumentNullException(nameof(contestRepository)); }