private void Button_DelRenter(object sender, RoutedEventArgs e) { RestService restservice = new RestService(WebAddress.Address(), "/renter", token.Token); restservice.Delete <string>((dGrid.SelectedItem as Renters).RenterId); GetRenters(); }
private void OK_Click(object sender, RoutedEventArgs e) { if (salonId != null) { Salons s = new Salons(); s.PostalCode = postalCode.Text.ToString(); s.City = city.Text.ToString(); s.Address = address.Text.ToString(); s.SalonId = salonId; RestService restService = new RestService(WebAddress.Address(), "/salons", token.Token); restService.Put <string, Salons>(salonId, s); salonId = null; } else { Salons s = new Salons(); s.PostalCode = postalCode.Text.ToString(); s.City = city.Text.ToString(); s.Address = address.Text.ToString(); RestService restService = new RestService(WebAddress.Address(), "/salons", token.Token); restService.Post <Salons>(s); } this.Close(); }
private void Button_DelSalon(object sender, RoutedEventArgs e) { RestService restService = new RestService(WebAddress.Address(), "/salons", token.Token); restService.Delete <string>((dGrid.SelectedItem as Salons).SalonId); GetSalons(); }
public async Task GetRenters() { dGrid.ItemsSource = null; RestService restservice = new RestService(WebAddress.Address(), "/renter", token.Token); IEnumerable <Renters> renters = await restservice.Get <Renters>(); dGrid.ItemsSource = renters; dGrid.SelectedIndex = 0; }
public async Task GetSalons() { dGrid.ItemsSource = null; RestService restservice = new RestService(WebAddress.Address(), "/salons", token.Token); IEnumerable <Salons> salons = await restservice.Get <Salons>(); dGrid.ItemsSource = salons; dGrid.SelectedIndex = 0; }
private void OK_Click(object sender, RoutedEventArgs e) { if (car != null) { Cars c = new Cars() { Make = this.make.Text.ToString(), Model = this.model.Text.ToString(), ModelYear = int.Parse(this.modelYear.Text), BodyType = this.bodyType.Text.ToString(), CombFuelEco = double.Parse(this.combFuelEco.Text.ToString()), PricePerDay = int.Parse(this.pricePerDay.Text), SalonId = car.SalonId, Available = car.Available, RenterId = car.RenterId, CarId = car.CarId, }; RestService restService = new RestService(WebAddress.Address(), "/cars", token.Token); restService.Put <string, Cars>(car.CarId, c); car = null; } else { Cars c = new Cars() { Make = this.make.Text.ToString(), Model = this.model.Text.ToString(), ModelYear = int.Parse(this.modelYear.Text), BodyType = this.bodyType.Text.ToString(), CombFuelEco = double.Parse(this.combFuelEco.Text.ToString()), Available = true, PricePerDay = int.Parse(this.pricePerDay.Text), SalonId = salonId, }; RestService restService = new RestService(WebAddress.Address(), "/cars", token.Token); restService.Post <Cars>(c); } this.Close(); }
private void OK_Click(object sender, RoutedEventArgs e) { if (renter != null) { Renters r = new Renters() { Name = this.name.Text.ToString(), PostalCode = this.postalCode.Text.ToString(), City = this.city.Text.ToString(), Address = this.address.Text.ToString(), Email = this.email.Text.ToString(), PhoneNumber = this.phoneNumber.Text.ToString(), RentedDays = int.Parse(this.rentedDays.Text), CarId = renter.CarId, RenterId = renter.RenterId, }; RestService restService = new RestService(WebAddress.Address(), "/renter", token.Token); restService.Put <string, Renters>(renter.RenterId, r); renter = null; } else { Renters r = new Renters() { Name = this.name.Text.ToString(), PostalCode = this.postalCode.Text.ToString(), City = this.city.Text.ToString(), Address = this.address.Text.ToString(), Email = this.email.Text.ToString(), PhoneNumber = this.phoneNumber.Text.ToString(), RentedDays = int.Parse(this.rentedDays.Text), CarId = carId, }; RestService restService = new RestService(WebAddress.Address(), "/renter", token.Token); restService.Post <Renters>(r); } this.Close(); }
public async Task Login() { UserName = this.username.Text.ToString(); PassWord = this.password.Password; RestService restService = new RestService(WebAddress.Address(), "/auth/Login"); TokenVM token = await restService.Put <TokenVM, LoginVM>(new LoginVM() { ValidationName = UserName, Password = PassWord }); if (token != null) { Window w = new MainWindow(token); w.Show(); this.Close(); } else { MessageBox.Show("Wrong username or password"); } }