private void OnDeletePortion(string value) { if (SelectedPortion != null) { Workspace.Delete(SelectedPortion.Model); Model.Portions.Remove(SelectedPortion.Model); Portions.Remove(SelectedPortion); } }
private void OnDeletePortion(string value) { if (SelectedPortion != null) { var c = Dao.Count <Recipe>(x => x.Portion.Id == SelectedPortion.Model.Id); if (c == 0) { if (SelectedPortion.Model.Id > 0 && Model.Id > 0) { _workspace.Delete(SelectedPortion.Model); } Model.Portions.Remove(SelectedPortion.Model); Portions.Remove(SelectedPortion); } } }