private void DeleteZoneAction()
        {
            var zone = _viewmodel.SelectedZone;

            if (zone == null)
            {
                return;
            }

            MessageBoxResult result = MessageBox.Show(_view, $"Delete Zone \"{_viewmodel.SelectedZone.Name}\"?", "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Question);

            if (result == MessageBoxResult.Cancel)
            {
                return;
            }

            _zoneRepo.DeleteZone(zone.Id);

            var index = _viewmodel.Zones.IndexOf(zone);

            _viewmodel.Zones.Remove(zone);
            if (_viewmodel.Zones.Count > 0)
            {
                if (_viewmodel.Zones.Count > index)
                {
                    _select(_viewmodel.Zones[index]);
                }
                else
                {
                    _select(_viewmodel.Zones.Last());
                }
            }
        }
Beispiel #2
0
 public async Task <bool> DeleteZone(string id)
 {
     return(await _ZoneRepo.DeleteZone(id));
 }