public async Task UpsertOpenCompetition(Competition competition) { var entity = new OpenCompetitionEntity(competition.Id) { ServiceUrl = competition.ServiceUrl, TenantId = competition.TenantId, TeamId = competition.TeamId, ChannelId = competition.ChannelId, MainActivityId = competition.MainActivityId, ResultActivityId = competition.ResultActivityId, CreatedTime = competition.CreatedTime, PlannedDrawTime = competition.PlannedDrawTime, ActualDrawTime = competition.ActualDrawTime, Locale = competition.Locale, OffsetHours = competition.OffsetHours, Gift = competition.Gift, GiftImageUrl = competition.GiftImageUrl, WinnerCount = competition.WinnerCount, Status = competition.Status, CreatorName = competition.CreatorName, CreatorAadObjectId = competition.CreatorAadObjectId, WinnerAadObjectIds = competition.WinnerAadObjectIds, Competitors = competition.Competitors }; await OpenCompetitions.InsertOrReplace(entity); }
public async Task <Competition> GetOpenCompetition(Guid competitionId) { var entity = await OpenCompetitions.Retrieve(new OpenCompetitionEntity(competitionId)); if (entity == null) { return(null); } return(new Competition { Id = entity.Id, ServiceUrl = entity.ServiceUrl, TenantId = entity.TenantId, TeamId = entity.TeamId, ChannelId = entity.ChannelId, MainActivityId = entity.MainActivityId, ResultActivityId = entity.ResultActivityId, CreatedTime = entity.CreatedTime, PlannedDrawTime = entity.PlannedDrawTime, ActualDrawTime = entity.ActualDrawTime, Locale = entity.Locale, OffsetHours = entity.OffsetHours, Gift = entity.Gift, GiftImageUrl = entity.GiftImageUrl, WinnerCount = entity.WinnerCount, Status = entity.Status, CreatorName = entity.CreatorName, CreatorAadObjectId = entity.CreatorAadObjectId, WinnerAadObjectIds = entity.WinnerAadObjectIds, Competitors = entity.Competitors }); }
public async Task <List <Guid> > GetOpenCompetitionIds(DateTimeOffset maxPlannedDrawTime) { var openCompetitions = await OpenCompetitions.Query( $"PlannedDrawTime lt datetime'{maxPlannedDrawTime.ToString("yyyy-MM-ddTHH:mm:ss")}Z'", selectColumns : new List <string> { "Id" }); return(openCompetitions.Select(oc => oc.Id).ToList()); }
public async Task DeleteOpenCompetition(Guid competitionId) { await OpenCompetitions.Delete(new OpenCompetitionEntity(competitionId)); }