private void ExecuteSave() { try { if (NewSafe.Statement == null || NewSafe.Amount == null) { return; } using (var unitOfWork = new UnitOfWork(new GeneralDBContext())) { unitOfWork.Safes.Add(new Safe { Amount = _newSafe.Amount, Statement = _newSafe.Statement, Type = true, RegistrationDate = DateTime.Now, UserID = UserData.ID, CanDelete = true }); unitOfWork.Complete(); _statementSuggestions.Add(_newSafe.Statement); NewSafe = new SafeAddDataModel(); Load(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private async void ShowAddMethod() { try { NewSafe = new SafeAddDataModel(); safeAddDialog.DataContext = this; await currentWindow.ShowMetroDialogAsync(safeAddDialog); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }