public void Update(BoekingModel boekingModel) { boekingModel.Tamagotchis.ForEach(t => { _context.Entry(t.ToModel()).State = EntityState.Modified; }); }
public ActionResult Confirm(BoekingModel boeking) { _boekingRepository.Create(boeking); _boekingRepository.Save(); return(View()); }
public void Create(BoekingModel boeking) { Hotelkamer hk = _context.Hotelkamers.First(h => h.Id.Equals(boeking.Hotelkamer.Id)); foreach (TamagotchiModel tamagotchiModel in boeking.Tamagotchis) { hk.Tamagotchis.Add(_context.Tamagotchis.First(t => t.Id.Equals(tamagotchiModel.Id))); } _context.Entry(hk).State = EntityState.Modified; }
public BoekingModel GetByRoom(HotelkamerModel hotelkamer) { BoekingModel boekingModel = new BoekingModel(); boekingModel.Hotelkamer = hotelkamer; boekingModel.Tamagotchis = boekingModel.Hotelkamer.Tamagotchis.Select(t => new TamagotchiModel() { _tamagotchi = t }).ToList(); return(boekingModel); }
public ActionResult Book(BoekingModel boeking) { boeking.Tamagotchis = boeking.AvTamagotchis.Where(m => m.IsSelected == true).ToList(); if (boeking.Tamagotchis == null) { TempData["Errorlist"] = "Er zijn te veel of te weinig tamagotchi geselecteerd. Kijk goed naar de maximum groote van een kamer."; return(RedirectToAction("Tamagotchis", "Boeking", new { id = boeking.Hotelkamer.Id })); } return(View(boeking)); }
//public async Task<IActionResult> Edit(int id, [Bind("Id,BandId,Datum,BeginUur,EindUur,KleedkamerBeginUur,KleedkamerEindUur,PodiumId,TentId")] Boeking boeking) public IActionResult Edit(int id, BoekingModel model) { DataManager dataManager = new DataManager(_context); if (id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { if (model.PodiumId == 0) { return(View(model)); } try { var boeking = new vm_boeking(_context) { BoekingModel = model }; boeking.Save(); } catch (DbUpdateConcurrencyException) { if (!BoekingExists(model.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PodiumId"] = new SelectList(dataManager.GetAllPodia(), "Id", "Omschrijving", model.PodiumId); ViewData["TentId"] = new SelectList(dataManager.GetAllTenten(), "Id", "Omschrijving", model.TentId); ViewData["KleedkamerId"] = new SelectList(dataManager.GetAllKleedkamers(), "Id", "Omschrijving"); ViewData["ProductieEenheidId"] = new SelectList(dataManager.GetAllProductieEenheden(), "Id", "Omschrijving"); ViewData["BegeleiderId"] = new SelectList(dataManager.GetAllBegeleiders(), "Omschrijving", "Omschrijving"); return(View(model)); }
public void Boeken() { if (selectedLocation != null) { BoekingModel boeking = new BoekingModel(dateVanaf, timeVanaf, dateTot, timeTot, currentuser.UserId, selectedLocation.LocationId, selectedLocation); boeking.Location = selectedLocation; boekingDataService boekingDS = new boekingDataService(); UserDataService userDS = new UserDataService(); boekingDS.InsertBoeking(boeking); currentuser.Punten += 100; userDS.UpdatePunten(currentuser); Messenger.Default.Unregister(this); Messenger.Default.Send <BoekingModel>(boeking); Messenger.Default.Register <CloseMessage>(this, OnMessageReceived); dialogService.ShowDetailDialog(); } }
public ActionResult Tamagotchis(int id) { if (TempData["Errorlist"] != null) { ViewBag.Errorlist = TempData["Errorlist"].ToString(); } BoekingModel boekingModel = new BoekingModel(); HotelkamerModel hotelkamer = _hotelkamerRepository.Get(id); hotelkamer.Prijs = Kamer.GetKamer(hotelkamer.Type).Price; if (hotelkamer != null) { boekingModel.Hotelkamer = hotelkamer; } List <TamagotchiModel> tamagotchis = _tamagotchiRepository.GetAllAlive().Where(t => t.Centjes >= hotelkamer.Prijs).ToList(); if (tamagotchis.Count > 0) { _hotelkamerRepository.GetAll().Where(t => t.Tamagotchis.Count > 0).ToList().ForEach((h) => { foreach (var objTamagotchi in h.Tamagotchis) { for (int i = 0; i < tamagotchis.Count; i++) { if (tamagotchis[i].Id == objTamagotchi.Id) { tamagotchis.Remove(tamagotchis[i]); i--; } } } }); boekingModel.AvTamagotchis = tamagotchis; return(View(boekingModel)); } return(Index()); }
public IActionResult Create(BoekingModel model) { if (model == null) { return(View(model)); } else { if (model.PodiumId == 0) { return(View(model)); } else { vm_boeking boeking = new vm_boeking(_context) { BoekingModel = model }; boeking.Save(); return(RedirectToAction(nameof(Index))); } } }
public void Delete(BoekingModel boeking) { throw new NotImplementedException(); }
public BoekingDetailMessage(Location location, BoekingModel boekingg) { Location = location; Boeking = boekingg; Console.WriteLine("BoekingdetailMessage: " + location.Omschrijving + " " + boekingg.Locationid); }
public void LadenData(BoekingModel obj) { Console.WriteLine("LadenData in boekingdetaiilviewmodel" + " " + obj.Locationid + obj.Location.Omschrijving); obj.DateVanaf = obj.DateVanaf.Date; Boeking = obj; }