private async void DeleteMainCat(MainCatViewModel list) { try { await _service.DeleteMainCatAsync(list.Id); MainCats.Remove(SelectedMainCat); SelectedMainCat = null; } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } }
private async void AddMainCat() { var newList = new MainCatViewModel { Name = "New MainCat" }; var listDto = (MainCatDto)newList; try { await _service.CreateMainCatAsync(listDto); newList.Id = listDto.Id; MainCats.Add(newList); SelectedMainCat = newList; } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } }