public async void GetTimeSlots() { try { IsServiceInProgress = true; var email = App.SelectedView.Equals("Trainee") ? (App.TrainerData == null ? App.LoginResponse.Email : App.TrainerData.Email) : App.LoginResponse.Email; String currentMonth = currentDate.Month > 9 ? currentDate.Month.ToString() : "0" + (currentDate.Month.ToString()); var request = new GetTimeSlotRequest { emailID = App.LoginResponse.Email }; TimeSlotResponse = await App.TodoManager.GetTimeSlots(request); if (TimeSlotResponse != null && TimeSlotResponse.TimeSlots.timeSlot.Any()) { List <SpecialDate> bookedDates = new List <SpecialDate>(); foreach (var item in TimeSlotResponse.TimeSlots.timeSlot) { DateTime date = new DateTime(Convert.ToInt32(item.year), Convert.ToInt32(item.month), Convert.ToInt32(item.day)); bookedDates.Add(new SpecialDate(date) { BackgroundColor = Color.Red, Selectable = true }); } Attendances = new ObservableCollection <SpecialDate>(bookedDates); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } IsServiceInProgress = false; }
public async Task <GetTimeSlotResponse> GetTimeSlots(GetTimeSlotRequest getTimeSlotRequest) { if (CrossConnectivity.Current.IsConnected) { try { Uri uri; if (App.SelectedView == "Trainee") { uri = new Uri("http://104.238.81.169:4080/FitnessApp/manageservices/v1/members/trainee/getTimeSlots"); } else { uri = new Uri("http://104.238.81.169:4080/FitnessApp/manageservices/v1/members/getTimeSlots"); } var json = JsonConvert.SerializeObject(getTimeSlotRequest); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = null; response = await client.PostAsync(uri, content); if (response.IsSuccessStatusCode) { var responseJson = response.Content.ReadAsStringAsync().Result; var result = JsonConvert.DeserializeObject <GetTimeSlotResponse>(responseJson); return(result); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } return(null); }
public Task <GetTimeSlotResponse> GetTimeSlots(GetTimeSlotRequest getTimeSlotRequest) { return(restService.GetTimeSlots(getTimeSlotRequest)); }
public Task <GetTimeSlotResponse> GetTimeSlots(GetTimeSlotRequest getTimeSlotRequest) { throw new NotImplementedException(); }