Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Tamagotchi tamagotchi = _tamagotchiRepository.Get(id);

            _tamagotchiRepository.Delete(tamagotchi);
            return(RedirectToAction("Index"));
        }
        public void Complete(RoomViewModel roomViewModel)
        {
            Room room = _roomRepository.Get(_detailsRoomVM.Room.ID);
            List <Tamagotchi> SelectedTamagotchiList = _detailsRoomVM.Tamagotichis.Select(t => _tamagotchiRepository.Get(t.ID)).ToList();

            room.TamagotchiList = SelectedTamagotchiList;
            //SelectedTamagotchiList.ForEach(t => _tamagotchiRepository.SetRoom(room, t));
            SelectedTamagotchiList.ForEach(t => _tamagotchiRepository.Delete(t));
            _roomRepository.Update(room);
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TamagotchiModel tamagotchi = _tamagotchiRepository.Get(id);

            if (tamagotchi.HotelKamers.Count == 0)
            {
                _tamagotchiRepository.Delete(tamagotchi);
                _tamagotchiRepository.Save();
            }
            else
            {
                TempData["Error"] = "Er is nog een openstaande boeking voor deze tamagotchi.";
                return(RedirectToAction("Delete", new { id = tamagotchi.Id }));
            }
            return(RedirectToAction("Index"));
        }