public AdminFacade(DataReaderBuilder dataReaderBuilder, DataSaver saver, IHostingEnvironment env, CompetitionsService competitionsService) { this.externaldDataReaderBuilder = dataReaderBuilder; this.externalDataSaver = saver; this.env = env; this.competitionsService = competitionsService; }
private async Task HandleDelete() { IsDeleting = true; await CompetitionsService.DeleteCompetition(CompetitionId); Navigation.NavigateTo("/"); }
private async Task HandleSubmit() { IsFormSubmitting = true; await WeighInDeadlinesService.DeleteWeighInDeadlineRangeByCompetition(CompetitionId); await CompetitionsService.PutCompetition(Competition.CompetitionId, Competition); Navigation.NavigateTo($"/competition-detail/{Competition.CompetitionId}"); }
private async Task HandleSubmit() { IsFormSubmitting = true; Competition.CreateDate = Competition.CreateDate.ToUniversalTime(); Competition.CreatedBy = Username; Competition.CreatedByUserId = UserId; Competition = await CompetitionsService.PostCompetition(Competition); Navigation.NavigateTo($"/competition-detail/{Competition.CompetitionId}"); }
protected override async Task OnInitializedAsync() { var authState = await AuthenticationStateTask; var user = authState.User; if (user.Identity.IsAuthenticated) { UserId = user.FindFirst(c => c.Type == "sub").Value; } Competition = await CompetitionsService.GetCompetition(CompetitionId); Contestant = Competition.Contestants.FirstOrDefault(c => c.UserId == UserId); WeightLog.ContestantId = Contestant.ContestantId; }
protected override async Task OnInitializedAsync() { var authState = await AuthenticationStateTask; var user = authState.User; if (user.Identity.IsAuthenticated) { UserId = user.FindFirst(c => c.Type == "sub").Value; Username = user.FindFirst(c => c.Type == "name").Value; } Competition = await CompetitionsService.GetCompetition(CompetitionId); _startDate = Competition.StartDate; _numberOfWeeks = Competition.NumberOfWeeks; }
protected override async Task OnInitializedAsync() { var authState = await AuthenticationStateTask; var user = authState.User; if (user.Identity.IsAuthenticated) { UserId = user.FindFirst(c => c.Type == "sub").Value; Username = user.FindFirst(c => c.Type == "name").Value; FirstName = user.FindFirst(c => c.Type == "given_name").Value; LastName = user.FindFirst(c => c.Type == "family_name").Value; } Competition = await CompetitionsService.GetCompetition(CompetitionId); Competition.CreateDate.ToLocalTime(); }
public async Task HandleContestantJoin() { IsContestantJoining = true; var contestant = new Contestant() { UserId = UserId, FirstName = FirstName, LastName = LastName, Username = Username, CompetitionId = Competition.CompetitionId }; contestant = await ContestantsService.PostContestant(contestant); Competition = await CompetitionsService.GetCompetition(CompetitionId); IsContestantJoining = false; }
public void SetUp() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; this.dbContext = new ApplicationDbContext(options); this.competitionsService = new CompetitionsService(dbContext); User user = new User() { Id = "id", UserName = "******" }; this.dbContext.Users.Add(user); this.dbContext.SaveChanges(); }
public CompetitionsController(CompetitionsService service) { this.service = service; }
protected async override Task OnInitializedAsync() { Competition = await CompetitionsService.GetCompetition(CompetitionId); CompetitionResults = Competition.GetWeeklyResults(); }