public async override void OnNavigatedTo(NavigationParameters parameters) { SubjectModel subject = parameters["subject"] as SubjectModel; Subject = subject; PopulateDetailsProps(subject); GetNote(); try { StudentiPrezenti.Clear(); var response = await StudentService.GetAllBySubject(Subject.Id); var content = await response.Content.ReadAsStringAsync(); var message = JsonConvert.DeserializeObject <List <StudentModel> >(content); StudentiPrezenti.ReplaceRange(message); } catch (Exception ex) { MessagingCenter.Send(new ErrorMessageModel { Title = "Error", Message = "Unable to load items.", Cancel = "OK" }, "message"); } }
public async void OnPrezentSelected() { if (student == null) { var response = await StudentService.GetById(); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); student = JsonConvert.DeserializeObject <StudentModel>(content); } } if (student != null && !StudentiPrezenti.Any(a => a.Nume == student.Nume)) { StudentiPrezenti.Add(student); } }