private async Task SaveVoertuigStateAsync() { currentVoertuigen = new Voertuigen(); currentVoertuigen = voertuigenService.GetVoertuigenLijst(3).Result; currentKlant = new Klant(); currentKlant.Naam = Naam; currentKlant.Telefoonnummer = Telefoonnummer; //currentKlant.Email = Email; currentKlant.Adres = Adres; currentKlant.KlantStatus = KlantStatus.Koper; currentKlant.Woonplaats = Woonplaats; currentKlant.Id = new Guid(); await klantenService.SaveKlant(currentKlant); await klantenService.GetKlantById(currentKlant.Id); //currentAuto = new Auto(); currentAuto.Merk = Merk; currentAuto.Model = Model; currentAuto.Prijs = Convert.ToDecimal(Prijs); currentAuto.Bouwjaar = Convert.ToInt16(Bouwjaar); currentAuto.Vraag = Convert.ToDateTime(currentAuto.Vraag.ToString("dd-MMM-yyyy")); currentAuto.KlantNaam = currentKlant.Naam; currentAuto.KlantId = currentKlant.Id; //currentVoertuigen.Autoos.Add(currentAuto); await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); if (currentAuto.AutoStatus == (AutoStatus)Enum.Parse(typeof(AutoStatus), "Gekocht")) { var autolijst = await voertuigenService.GetVoertuigenLijst(1); if (autolijst.Autoos == null) { autolijst.Autoos = new List <Auto>(); } autolijst.Autoos.Add(currentAuto); currentVoertuigen.Autoos.Remove(currentAuto); await voertuigenService.SaveVoertuigenLijst(autolijst); await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); } await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); }
private async Task EditVoertuigStateAsync() { id = currentAuto.Id; currentVoertuigen = await voertuigenService.GetVoertuigenLijst(1); currentAuto = currentVoertuigen.Autoos.FirstOrDefault(currentAuto => currentAuto.Id == Id); if (currentAuto != null) { currentKlant = new Klant(); currentKlant.Naam = Naam; currentKlant.Telefoonnummer = Telefoonnummer; currentKlant.Adres = Adres; currentKlant.KlantStatus = KlantStatus.Verkoper; currentKlant.Woonplaats = Woonplaats; currentKlant.Id = new Guid(); currentAuto.Merk = Merk; currentAuto.Model = Model; currentAuto.Prijs = Convert.ToDecimal(Prijs); currentAuto.AutoStatus = (AutoStatus)Enum.Parse(typeof(AutoStatus), AutoStatus); currentAuto.Bouwjaar = Convert.ToInt16(Bouwjaar); currentAuto.Verkoop = Convert.ToDateTime(Verkoop); currentAuto.KMstand = Convert.ToInt32(KmStand); currentAuto.KlantId = currentKlant.Id; currentAuto.KlantNaam = currentKlant.Naam; await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); } }
private async Task EditFotoAsync() { var currentVoertuigen = await voertuigenService.GetVoertuigenLijst(0); var auto = currentVoertuigen.Autoos.FirstOrDefault(currentAuto => currentAuto.Id == Id); if (auto != null) { auto.Foto = Foto; await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); } }
private async Task SaveVoertuigStateAsync() { currentVoertuigen = new Voertuigen(); currentVoertuigen = voertuigenService.GetVoertuigenLijst(0).Result; currentKlant = new Klant(); currentKlant.Naam = Naam; currentKlant.Telefoonnummer = Telefoonnummer; currentKlant.Email = Email; currentKlant.Adres = Adres; currentKlant.KlantStatus = KlantStatus.Verkoper; currentKlant.Woonplaats = Woonplaats; currentKlant.Id = new Guid(); await klantenService.SaveKlant(currentKlant); await klantenService.GetKlantById(currentKlant.Id); currentKlant.Auto = new Auto(); currentAuto = new Auto(); currentAuto.Merk = Merk; currentAuto.Model = Model; currentAuto.Prijs = Convert.ToDecimal(Prijs); currentAuto.Bouwjaar = Convert.ToInt16(Bouwjaar); currentAuto.AanBod = Aanbod; currentAuto.KlantNaam = currentKlant.Naam; currentAuto.KlantId = currentKlant.Id; currentVoertuigen.Autoos.Add(currentAuto); await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); currentKlant.Auto.AanBod = currentAuto.AanBod; currentKlant.Auto.Merk = currentAuto.Merk; currentKlant.Auto.Model = currentAuto.Model; currentKlant.Auto.Prijs = currentAuto.Prijs; currentKlant.AutoId = currentAuto.Id; }
private async Task EditVoertuigStateAsync() { id = currentAuto.Id; currentVoertuigen = await voertuigenService.GetVoertuigenLijst(0); var auto = currentVoertuigen.Autoos.FirstOrDefault(currentAuto => currentAuto.Id == Id); if (auto != null) { auto.Merk = Merk; auto.Model = Model; auto.Prijs = Convert.ToDecimal(Prijs); auto.AutoStatus = (AutoStatus)Enum.Parse(typeof(AutoStatus), AutoStatus); auto.AanBod = Convert.ToDateTime(Aanbod); auto.Aankoop = Convert.ToDateTime(Aankoop); auto.Bouwjaar = Convert.ToInt16(Bouwjaar); auto.Brandstof = (Brandstof)Enum.Parse(typeof(Brandstof), Brandstof);; auto.Foto = Foto; auto.Verkoop = Convert.ToDateTime(Verkoop); auto.KMstand = Convert.ToInt32(KmStand); auto.EersteEigenaar = EersteEigenaar; } if (auto.AutoStatus == (AutoStatus)Enum.Parse(typeof(AutoStatus), "Gekocht")) { var autolijst = await voertuigenService.GetVoertuigenLijst(1); if (autolijst.Autoos == null) { autolijst.Autoos = new List <Auto>(); } autolijst.Autoos.Add(auto); currentVoertuigen.Autoos.Remove(auto); await voertuigenService.SaveVoertuigenLijst(autolijst); await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); } if (auto.AutoStatus == (AutoStatus)Enum.Parse(typeof(AutoStatus), "Verkocht")) { var autolijst = await voertuigenService.GetVoertuigenLijst(2); if (autolijst.Autoos == null) { autolijst.Autoos = new List <Auto>(); } autolijst.Autoos.Add(auto); currentVoertuigen.Autoos.Remove(auto); await voertuigenService.SaveVoertuigenLijst(autolijst); await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); } //Verplaatsen naar status.Vraag niet zinvol. //if (auto.AutoStatus == (AutoStatus)Enum.Parse(typeof(AutoStatus), "Vraag")) //{ // var autolijst = await voertuigenService.GetVoertuigenLijst(3); // if (autolijst.Autoos == null) autolijst.Autoos = new List<Auto>(); // autolijst.Autoos.Add(auto); // currentVoertuigen.Autoos.Remove(auto); // await voertuigenService.SaveVoertuigenLijst(autolijst); // await voertuigenService.SaveVoertuigenLijst(currentVoertuigen); //} }