/// <summary> /// Update armour with the same type as edited armour. /// </summary> public async void Update(string armourType) { await _data.Set(_mapper.Map <ArmourProtModel>(_editedArmour)); foreach (var armour in Armours.ToList()) { if (armour.ArmourType == armourType) { int index = Armours.IndexOf(armour); Armours.Insert(index, new ArmourProtDisplay(_editedArmour)); Armours.Remove(armour); Armours.Refresh(); } } SelectedArmour = null; }
/// <summary> /// Remove armour with the same type as edited armour. /// </summary> public async void Remove(string armourType) { var msg = await _data.Remove(_mapper.Map <ArmourProtModel>(_editedArmour)); if (msg != null) { MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Warning); return; } foreach (var armour in Armours.ToList()) { if (armour.ArmourType == armourType) { Armours.Remove(armour); } } _editedArmour = new ArmourProtDisplay(); SelectedArmour = null; }