public AddEditReceptViewModel(Recept recept, AddEditReceptView addEditReceptViewOpen, bool isForEdit) { this.isForEdit = isForEdit; this.recept = recept; addEditReceptView = addEditReceptViewOpen; ReceptTypsList = new ObservableCollection <ReceptType>(service.GettAllTypes()); SelectedReceptTyps = ReceptTypsList.FirstOrDefault(p => p.TypeID == recept.TypeId); TemporaryComponentList = new ObservableCollection <Components>(service.GettAllComponentsByReceptId(recept.ReceptId)); }
public void EditRecept() { try { Recept editRecept = new Recept(); editRecept.ReceptId = recept.ReceptId; editRecept.UserId = recept.UserId; editRecept.TypeId = recept.TypeId; editRecept.ReceptName = recept.ReceptName; editRecept.PersonNumber = recept.PersonNumber; editRecept.Author = recept.Author; editRecept.ReceptText = recept.ReceptText; AddEditReceptView addEditReceptWindow = new AddEditReceptView(editRecept, true); addEditReceptWindow.Show(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public AddEditReceptViewModel(AddEditReceptView addEditReceptViewOpen, bool isForEdit) { this.isForEdit = isForEdit; addEditReceptView = addEditReceptViewOpen; ReceptTypsList = new ObservableCollection <ReceptType>(service.GettAllTypes()); }