public async Task <ActionResult <Guid> > Post([FromBody] BeerContestModel contest) { if (!ModelState.IsValid) { return(BadRequest()); } var contestId = await this.AdminRepository.CreateContestAsync(contest); return(contestId); }
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); }