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); } }
public ActionResult DeleteConfirmed(string id) { Voertuigen voertuigen = db.Voertuigens.Find(id); db.Voertuigens.Remove(voertuigen); db.SaveChanges(); return(RedirectToAction("Index")); }
public override void Init(object initData) { base.Init(initData); voertuigenLijst = initData as Voertuigen; voertuigenVerkocht = new ObservableCollection <Auto>(voertuigenLijst.Autoos as List <Auto>); }
public ActionResult Edit([Bind(Include = "kenteken,categorieId,merk,type")] Voertuigen voertuigen) { if (ModelState.IsValid) { db.Entry(voertuigen).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.categorieId = new SelectList(db.categories, "categorieId", "categorieNaam", voertuigen.categorieId); return(View(voertuigen)); }
public ActionResult Create([Bind(Include = "kenteken,categorieId,merk,type")] Voertuigen voertuigen) { if (ModelState.IsValid) { db.Voertuigens.Add(voertuigen); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.categorieId = new SelectList(db.categories, "categorieId", "categorieNaam", voertuigen.categorieId); return(View(voertuigen)); }
public async Task SaveVoertuigenLijst(Voertuigen voertuigen) { await Task.Delay(Constants.Constants.Mocking.FakeDelay); var savedVoertuigen = VoertuigenLijsten.FirstOrDefault(v => v.Id == voertuigen.Id); if (savedVoertuigen == null) { savedVoertuigen = voertuigen; VoertuigenLijsten.Add(savedVoertuigen); } }
// GET: Voertuigens/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Voertuigen voertuigen = db.Voertuigens.Find(id); if (voertuigen == null) { return(HttpNotFound()); } return(View(voertuigen)); }
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); }
// GET: Voertuigens/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Voertuigen voertuigen = db.Voertuigens.Find(id); if (voertuigen == null) { return(HttpNotFound()); } ViewBag.categorieId = new SelectList(db.categories, "categorieId", "categorieNaam", voertuigen.categorieId); return(View(voertuigen)); }
public async Task SaveVoertuigenLijst(Voertuigen voertuigen) { await Task.Run(() => { try { connection.InsertOrReplaceWithChildren(voertuigen); } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } }); }
public async Task <Voertuigen> GetVoertuigenLijst(int voertuigenId) { return(await Task.Run <Voertuigen>(() => { try { Voertuigen voertuigenLijst = connection.Table <Voertuigen>().Where(v => v.Id == voertuigenId).FirstOrDefault(); if (voertuigenLijst != null) { connection.GetChildren <Voertuigen>(voertuigenLijst, true); } return voertuigenLijst; } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } })); }
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; }
public void VerkoopAuto(string kenteken) { Kassa += Voertuigen[kenteken].Prijs; Voertuigen.Remove(kenteken); }
public void VoegAutoToe(IVoertuig voertuig) { Voertuigen.Add(voertuig.Kenteken, voertuig); }
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); //} }