public ActionResult AddReservation(CustomerReservationModel model) { if (ModelState.IsValid) { var customer = new ApiClient().PostData <CustomerDto, CustomerDto>("api/customer/GetOrAddCustomer", new CustomerDto() { CustomerName = model.Customer.CustomerName, CustomerSurname = model.Customer.CustomerSurname, Email = model.Customer.Email, Phone = model.Customer.Phone }); var result1 = new ApiClient().PostData <ReservationDto>("api/Reservation/Post", new ReservationDto() { ShowingId = model.Reservation.ShowingId, RowSeatId = model.Reservation.RowSeatId, CustomerId = customer.Id, Status = 0, }); if (result1 == true) { return(RedirectToAction("Index")); } } List <RowSeatDto> seats = new ApiClient().GetData <List <RowSeatDto> >($"api/Reservation/GetSeats/{model.Reservation.ShowingId}"); model.Seats = seats; return(View(model)); }
public CustomerReservationModel getReservation(int reservationId, string token) { CustomerReservationModel reservationModel = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "Registration/getReservationbyId"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var url = string.Format( client.BaseAddress + "?reservationId=" + reservationId); var response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { var responseStream = response.Content.ReadAsStringAsync().Result; reservationModel = JsonConvert.DeserializeObject <CustomerReservationModel>(responseStream); } } } catch (Exception ex) { throw ex; } return(reservationModel); }
private void UpcomingReservationList_ItemSelected(object sender, SelectedItemChangedEventArgs e) { CustomerReservationModel reservationModel = upcomingReservationList.SelectedItem as CustomerReservationModel; ((ListView)sender).SelectedItem = null; if (Navigation.NavigationStack[Navigation.NavigationStack.Count - 1].GetType() != typeof(ViewReservation)) { Navigation.PushAsync(new ViewReservation(reservationModel.ReservationId)); } }
public CustomerReservationModel getReservation(int reservationId, string token) { CustomerReservationModel model = null; try { model = registerservice.getReservation(reservationId, token); } catch (Exception ex) { throw ex; } return(model); }
public ActionResult AddReservation(Showing showing) { var data = new Reservation() { ShowingId = showing.Id }; CustomerReservationModel model = new CustomerReservationModel() { Reservation = data, }; List <RowSeatDto> seats = new ApiClient().GetData <List <RowSeatDto> >($"api/Reservation/GetSeats/{showing.Id}"); model.Seats = seats; return(View(model)); }