Пример #1
0
        public async void UpdateAdmin(Admin admin)
        {
            await adminHandler.Put(admin.UserName, admin);

            //Opdatere cataloget så reload er unødvendig
            Admin oldAdmin = _adminCat.Admins.First(x => x.UserName == admin.UserName);
            int   index    = _adminCat.Admins.IndexOf(oldAdmin);

            _adminCat.Admins.Insert(index, admin);
        }
Пример #2
0
        public async void UpdateSpeaker(Speaker speaker)
        {
            await SpeakerFacade.Put(speaker.UserName, speaker);

            //Opdatere cataloget så reload er unødvendig
            Speaker oldSpeaker = _speakerCat.Speakers.First(x => x.UserName == speaker.UserName);
            int     index      = _speakerCat.Speakers.IndexOf(oldSpeaker);

            _speakerCat.Speakers.Insert(index, speaker);
        }
Пример #3
0
        public async void UpdateParticipant(Participant participant)
        {
            await participantFacade.Put(participant.UserName, participant);

            //Opdatere cataloget så reload er unødvendig
            Participant oldParticipant = _participantCat.Participants.First(x => x.UserName == participant.UserName);
            int         index          = _participantCat.Participants.IndexOf(oldParticipant);

            _participantCat.Participants.Insert(index, participant);
        }
Пример #4
0
        /// <summary>
        /// Denne medtode bliver bruger man til at opdaterer et lokale
        /// </summary>
        public async void UpdateRoom()
        {
            string roomNo = RoomViewModel.SelectedRoom.RoomNo;
            bool   ok     = await _genericPersistence.Put(roomNo, RoomViewModel.NewRoom);

            if (!ok)
            {
                await MessageDialogUtil.MessageDialogAsync("Der skete en fejl i Room", "Room blev ikke opdateret");
            }
            else
            {
                int index = RoomViewModel.RoomCatalog.Rooms.IndexOf(RoomViewModel.SelectedRoom);
                RoomViewModel.RoomCatalog.Rooms[index] = RoomViewModel.NewRoom;
                await MessageDialogUtil.MessageDialogAsync("Alt gik godt", $"Lokalet {roomNo} blev opdateret");

                RoomViewModel.NewRoom = new Room();
            }
        }
Пример #5
0
        public async Task <bool> Update(int id, Event @event)
        {
            Event oldEvent = _collection.Single((x) => x.Id == id);
            int   index    = _collection.IndexOf(oldEvent);

            _collection.Remove(oldEvent);
            CheckSpeaker(@event);
            CheckRoom(@event);
            CheckDate(@event);
            CheckImage(@event, false);

            _collection.Insert(index, @event);
            bool ok = await _eventPersistence.Put(id, @event);

            if (!ok)
            {
                _collection.Remove(@event);
                _collection.Insert(index, oldEvent);
                throw new BaseException("Thing no. 2. you thought would never happen. But of course it did");
            }

            return(true);
        }