public bool AddAccount(AccountViewModel viewModel)
        {
            var account = new Account();
            account.Name = viewModel.Name;
            account.Email = viewModel.Email;
            account.Url = viewModel.Url;
            account.Phone = viewModel.Phone;
            account.AccountType = (AccountTypeEnum)viewModel.AccountType;
            account.AccountStatus = (AccountStatusEnum)viewModel.AccountStatus;

            return _accountService.Add(account);
        }
        public void AddingTransactionToAccountDelegatesToAccountInstance()
        {
            // Arrange
            var account = new Account();
            var fakeRepository = new FakeAccountRepository(account);
            var sut = new AccountService(fakeRepository);

            // Act
            sut.AddTransactionToAccount("Trading Account", 200m);

            // Assert
            Assert.AreEqual(200m, account.Balance);
        }
Exemplo n.º 3
0
        public bool Update(Account account)
        {
            var accountToUpdate = _accountRepository.GetById(account.Id);
            accountToUpdate.Name = account.Name;
            accountToUpdate.Email = account.Email;
            accountToUpdate.Url = account.Url;
            accountToUpdate.Phone = account.Phone;
            accountToUpdate.AccountType = account.AccountType;
            accountToUpdate.AccountStatus = account.AccountStatus;

            _accountRepository.Update(accountToUpdate);
            _accountRepository.Save();
            return true;
        }
Exemplo n.º 4
0
 public AccountState(Guid id,IEventSink events)
 {
     _account = new Account();
     _account.AccountId = id;
     Events = events;
 }
 public void AuthenticateAs(Account account)
 {
     _account = account;
     _accountRepository = Substitute.For<IAccountRepository>();
     _accountRepository.GetAccount(account.AccountNo).Returns(account);
 }
Exemplo n.º 6
0
 public bool Add(Account account)
 {
     _accountRepository.Insert(account);
     _accountRepository.Save();
     return true;
 }
Exemplo n.º 7
0
        public ActionResult PerformCRUDAction(Account account)
        {
            bool result = false;
            switch (Request.Form["oper"])
            {
                case "add":
                    result = _accountService.Add(account);
                    break;
                case "edit":
                    int id = Int32.Parse(Request.Form["id"]);
                    account.Id = id;
                    result = _accountService.Update(account);
                    break;
                case "del":
                    id = Int32.Parse(Request.Form["id"]);
                    account.Id = id;
                  //  result = _accountService.Delete(account);

                    break;
                default:
                    break;
            }
            return Json(result);
        }
 public FakeAccountRepository(Account account)
 {
     this.account = account;
 }