Beispiel #1
0
        public IAccountResult UpdateItem(IAccount model)
        {
            IAccountResult accountResult;

            using (var conn = _connectionFactory.GetConnection())
            {
                var result = conn.Update(model);

                if (result == true)
                {
                    accountResult      = new AccountSuccessResult();
                    accountResult.Item = model;
                }
                else
                {
                    accountResult = new AccountFailureResult();
                    accountResult.AddData("Unable to update account Id " + model.AccountId);
                }
            }

            return(accountResult);
        }
Beispiel #2
0
        public IAccountResult GetItem(int key)
        {
            IAccountResult accountResult;

            using (var conn = _connectionFactory.GetConnection())
            {
                var result = conn.Get <IAccount>(new AccountDTO {
                    AccountId = key
                });

                if (result != null)
                {
                    accountResult      = new AccountSuccessResult();
                    accountResult.Item = result;
                }
                else
                {
                    accountResult = new AccountFailureResult();
                    accountResult.AddData("Unable to locate account Id " + key);
                }
            }

            return(accountResult);
        }