public async Task <List <ReservationModel> > GetPitchesMultiplesBusyCustomerAsync(int id, DateTime date) { var uri = new Uri(string.Format("{0}api/reservations/customer/busy/multiple", _uriBase)); AddAuth(); var json = JsonConvert.SerializeObject(new { id_place = id, date = date.ToString("yyyy-MM-dd") }); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = null; response = await _client.PostAsync(uri, content); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsStringAsync(); List <ReservationModel> placeModels = JArray.Parse(result).Select(x => new ReservationModel { Pitch = new PitchModel { Id = (int)x["id_pitch"] }, Date = FunctionsService.GetHour((string)x["hour"]), Status = FunctionsService.GetStatus((int)x["status"]), IdReservation = (int)x["id_reservation"], Source = (int)x["source"] }).ToList(); return(placeModels); } else { return(null); } }
List <HourModel> GetHours(JToken json) { List <HourModel> model = JArray.Parse(json.ToString()).Select(x => new HourModel { NumberDay = (int)x["id_day"], HourStart = FunctionsService.GetHour((string)x["hour_start"]), HourEnd = FunctionsService.GetHour((string)x["hour_end"]) }).ToList(); return(model); }