/// <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(); } }
public async void Clear() { bool ok = await MessageDialogUtil.InputDialogAsync("Er du sikker?", "Er du sikker på at du vil afmelde alle deltagere fra denne begivenhed"); if (ok) { await RegiSing.ClearRegistration(ShownEvent); } IsSubed = false; ChangeSubButton(); OnPropertyChanged(nameof(RemainingSpots)); OnPropertyChanged(nameof(TakenSpots)); }
public async void Delete() { bool ok = await MessageDialogUtil.InputDialogAsync("Er du sikker?", "Er du sikker på at du vil slette denne begivenhed fuldstændig"); if (ok) { ViewModel.LoadText = "Sletter begivenheden"; await RegiSing.DeleteEvent(ShownEvent); ok = await EventSing.EventCatalog.Remove(ShownEvent.Id); ok = ok && await ImageSingleton.Instance.ImageCatalog.RemoveImage(ShownEvent.ImageName); if (!ok) { ViewModel.LoadText = "Fejl"; throw new BaseException("Failed to delete event"); } ViewModel.LoadText = null; EventSing.ViewedEvent = null; MainViewModel.Instance.NavigateToPage(typeof(EventHomePage)); } }