/// <summary> /// Called on activation of the view model. /// </summary> protected async override void OnActivate() { _editedRoom = new RoomProtDisplay(); await Pull(); base.OnActivate(); }
/// <summary> /// Remove room with the same type as edited room. /// </summary> public async void Remove(string roomType) { var msg = await _data.Remove(_mapper.Map <RoomProtModel>(_editedRoom)); if (msg != null) { MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Warning); return; } foreach (var room in Rooms.ToList()) { if (room.RoomType == roomType) { Rooms.Remove(room); } } _editedRoom = new RoomProtDisplay(); SelectedRoom = null; }