public void SetStudentActivity(Student student)
 {
     _student = student;
     if (_student.IsActive)
     {
         MsgDialog = new MessageDialog(_student.Name + " er Aktiv. Vil du markere denne som Inaktiv?");
         _currentActivityType = "student";
         MsgDialog.Commands.Add(new UICommand("Ja", InactivityClick));
         MsgDialog.Commands.Add(new UICommand("Nej"));
         MsgDialog.ShowAsync();
     }
     else if (!_student.IsActive)
     {
         MsgDialog = new MessageDialog(_student.Name + " er Inaktiv. Vil du markere denne som Aktiv?");
         _currentActivityType = "student";
         MsgDialog.Commands.Add(new UICommand("Ja", ActivityClick));
         MsgDialog.Commands.Add(new UICommand("Nej"));
         MsgDialog.ShowAsync();
     }
 }
 public async void CreateStudent(Team team)
 {
     if (Name == null || Name == "")
     {
         MsgDialog = new MessageDialog("Indtast medlemmets navn.");
         MsgDialog.ShowAsync();
     }
     else if (team != null)
     {
         int teamNumber = team.Id;
         Student newStudent = new Student(Name, teamNumber);
         await WsContext.CreateStudent(newStudent);
         WsContext.LoadStudents();
         frame.Navigate(typeof (CreateNewPage));
     }
     
 
 }
Ejemplo n.º 3
0
        public async Task UpdateStudent(Student student)
        {
            handler = new HttpClientHandler();
            handler.UseDefaultCredentials = true;

            using (var client = new HttpClient(handler))
            {
                client.BaseAddress = new Uri(ServerUrl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                try
                {
                    var response = await client.PutAsJsonAsync("Students/" + student.Id, student, CancelToken.Token);
                }
                catch (Exception ex)
                {
                    new MessageDialog(ex.Message).ShowAsync();
                }

            }
        }