Example #1
0
        /// <summary>
        /// Denne metode bliver brugt til at slette et lokale
        /// </summary>
        public async void DeleteRoom()
        {
            bool sure = await MessageDialogUtil.InputDialogAsync("Hvad?", "er du sikker på du vil slette");

            if (!sure)
            {
                return;
            }

            string roomNo = RoomViewModel.SelectedRoom.RoomNo;
            bool   ok     = await _genericPersistence.Delete(roomNo);


            if (!ok)
            {
                await MessageDialogUtil.MessageDialogAsync("Der skete en fejl i Room", "Room blev ikke slettet");
            }
            else
            {
                RoomViewModel.RoomCatalog.Rooms.Remove(RoomViewModel.SelectedRoom);
                await MessageDialogUtil.MessageDialogAsync("Alt gik godt", $"Lokalet {roomNo} blev slettet");

                RoomViewModel.NewRoom = new Room();
            }
        }
Example #2
0
        public async void DeleteAdmin(Admin admin)
        {
            await adminHandler.Delete(admin.UserName);

            //Sletter til cataloget så reload er unødvendig
            Admin oldAdmin = _adminCat.Admins.First(x => x.UserName == admin.UserName);

            _adminCat.Admins.Remove(oldAdmin);
        }
Example #3
0
        public async void DeleteParticipant(Participant participant)
        {
            await participantFacade.Delete(participant.UserName);

            //Sletter til cataloget så reload er unødvendig
            Participant oldParticipant = _participantCat.Participants.First(x => x.UserName == participant.UserName);

            _participantCat.Participants.Remove(oldParticipant);
        }
Example #4
0
        public async void DeleteSpeaker(Speaker speaker)
        {
            await SpeakerFacade.Delete(speaker.UserName);

            //Sletter til cataloget så reload er unødvendig
            Speaker oldSpeaker = _speakerCat.Speakers.First(x => x.UserName == speaker.UserName);

            _speakerCat.Speakers.Remove(oldSpeaker);
        }
Example #5
0
        public async Task <bool> Remove(int id)
        {
            Event @event = _collection.Single((x) => x.Id == id);

            _collection.Remove(@event);
            bool ok = await _eventPersistence.Delete(id);

            if (!ok)
            {
                _collection.Add(@event);
                throw new BaseException("Thing no. 3. you thought would never happen. But of course it did");
            }

            return(true);
        }
        public async Task RemoveRegistration(Event @event, Participant participant)
        {
            Registration registration =
                Registrations.Find(x => x.EventId == @event.Id && x.UserName == participant.UserName);
            bool ok = await _registrationPersistence.Delete(registration.Id);

            if (ok)
            {
                Registrations.Remove(registration);
                RegistrationDictionary[@event].Remove(participant);
            }
            else
            {
                throw new BaseException("Remove regi fail");
            }
        }