public async void LoadResult() { var score = await _api.GetAllScore(); score = new ObservableCollection<Score>(score.OrderByDescending(i => i.TotalPoints)); Score = score; var groups = await _api.GetAllGroups(); groups = new ObservableCollection<Group>(groups); Groups = groups; foreach (var item in Score) { foreach (var i in Groups) { if (i.Id == item.Id) { var comp = new Competition { Name = i.Name, TotalScore = item.TotalPoints }; if (i.IsIntroGroup == true) { Competition.Add(comp); } } } } }
private void btnAddNew_Click(object sender, EventArgs e) { Competition competition = new Competition(); competition.CompetitionName = tbName.Text; competition.CompetitionStartDate = dpStart.Value; competition.CompetitionEndDate = dpEnd.Value; competition.CompetitionDescription = tbDetails.Text; competition.Add(); MessageBox.Show("Competition added with success!", "Success"); LoadInfo(); }