private async void DoneButton_Click(object sender, RoutedEventArgs e) { if (Name.Text.Length == 0) { MessageDialog dialog = new MessageDialog("You need to fill in a name."); } Team team = new Team() { Id = id, Deleted = false, Name = Name.Text }; await Api.Do.EditTeam(team); PageDispatch.ViewTeam(Frame, id); }
private async void DoneButton_Click(object sender, RoutedEventArgs e) { if (Name.Text.Length == 0) { MessageDialog dialog = new MessageDialog("You need to fill in a name."); await dialog.ShowAsync(); return; } Team team = new Team() { Deleted = false, Name = Name.Text }; var result = await Api.Do.CreateTeam(team, UserState.CurrentId); PageDispatch.ViewTeam(Frame, result.Id); }
public Task<Team> CreateTeam(Team team, string userId) { team.Id = random.Next(); teams.Add(team.Id, team); var membership = new Membership { Id = random.Next(), AccountId = userId, Status = MembershipStatus.Admin, TeamId = team.Id }; memberships.Add(membership.Id, membership); return Task.FromResult(team); }
public async Task<Team> EditTeam(Team team) { Team current = await GetTeam(team.Id); if (current == null) { throw new NotImplementedException(); } else { teams[team.Id] = team; return team; } }