Exemplo n.º 1
0
        private void BackToMenu(object sender, RoutedEventArgs e)
        {
            LeagueWindow win = new LeagueWindow(token);

            win.Show();
            this.Close();
        }
        private void Edit(object sender, RoutedEventArgs e)
        {
            RestService restService = new RestService("https://mlszproject.azurewebsites.net/", "/League", token);


            League league = new League()
            {
                Country = Country.Text, LeagueID = LeagueName.Content.ToString()
            };

            restService.Put <string, League>(l.LeagueID, league);

            LeagueWindow leagueWindow = new LeagueWindow(token);

            leagueWindow.Show();
            this.Close();
        }
        private void AddLeague(object sender, RoutedEventArgs e)
        {
            League league = new League
            {
                LeagueID = LeagueName.Text.ToString(),
                Country  = Country.Text.ToString()
            };


            RestService restservice = new RestService("https://mlszproject.azurewebsites.net/", "/League", token);

            restservice.Post <League>(league);

            LeagueWindow lwindow = new LeagueWindow(token);

            lwindow.Show();
            this.Close();
        }
Exemplo n.º 4
0
        private async void Login(object sender, RoutedEventArgs e)
        {
            RestService restservice = new RestService("https://mlszproject.azurewebsites.net/", "/Auth");

            TokenViewModel tokenviewmodel = await restservice.Put <TokenViewModel, LoginViewModel>(
                new LoginViewModel()
            {
                Username = UserName.Text,
                Password = Password.Password
            });

            token = tokenviewmodel.Token;

            if (token != null)
            {
                LeagueWindow leagueWindow = new LeagueWindow(token);
                leagueWindow.Show();
                this.Close();
            }
        }