public OperationResult SaveChanges() { var op = new OperationResult(); try { _repository.SaveChanges(); } catch(Exception ex) { Debug.Write(string.Format("Error during attempt to update database: {0}", ex)); op.IsSuccess = false; op.AddMessage("Unable to save changes. Please try again or contact support."); } return op; }
public OperationResult AddTransaction(Transaction newTransaction) { var op = new OperationResult(); try { _repository.AddTransaction(newTransaction); } catch(Exception ex) { Debug.Write(string.Format("Error during attempt to add new transaction: {0}", ex)); op.IsSuccess = false; op.AddMessage("Can't add new transaction. Please try again or contact support."); } return op; }
public OperationResult RemoveTransaction(int id) { var op = new OperationResult(); try { _repository.RemoveTransaction(id); } catch(Exception ex) { Debug.Write(string.Format("Error during attempt to delete transaction with id {0}: {1}", id, ex)); op.IsSuccess = false; op.AddMessage("Unable to remove transaction. Please try again or contact support."); } return op; }