Пример #1
0
        public CustomerDTO UpdateCustomer(CustomerUpdateSRO customer)
        {
            var entity = _repository.GetByGuid(customer.Guid);

            if (entity != null)
            {
                _updateEntityMapper.CopyTo(customer, entity);
                _repository.Update(entity);
                _repository.SaveChanges();
                return(_dtoMapper.Map(entity));
            }
            return(null);
        }
Пример #2
0
        public IActionResult Index([FromServices] ICustomerLogic customerLogic,
                                   [FromServices] IBankAccountLogic accountLogic,
                                   [FromServices] IBankTransactionLogic transactionLogic)
        {
            var new_customer = customerLogic.CreateCustomer(
                new CustomerCreateSRO {
                FirstName = "AAA", Initials = "B", LastName = "CCCCCC"
            });

            var update_customer =
                new CustomerUpdateSRO
            {
                Guid      = new_customer.Guid,
                FirstName = "David",
                Initials  = "J",
                LastName  = "Solomons"
            };
            var updated_customer = customerLogic.UpdateCustomer(update_customer);


            var acc1 = accountLogic.CreateAccount(updated_customer.Guid);
            var acc2 = accountLogic.CreateAccount(updated_customer.Guid);

            accountLogic.Deposit(
                new BankAccountLiquidizeSRO
            {
                GuidAccount = acc1.Guid,
                Value       = 10
            });
            accountLogic.Deposit(
                new BankAccountLiquidizeSRO
            {
                GuidAccount = acc2.Guid,
                Value       = 10
            });
            accountLogic.Withdraw(
                new BankAccountLiquidizeSRO
            {
                GuidAccount = acc1.Guid,
                Value       = 9
            });
            transactionLogic.Transfer(
                new BankTransactionExecuteSRO
            {
                GuidAccount = acc2.Guid,
                IbanAccount = acc2.Iban,
                IbanTarget  = acc1.Iban,
                Value       = 5
            });
            accountLogic.Withdraw(
                new BankAccountLiquidizeSRO
            {
                GuidAccount = acc1.Guid,
                Value       = 10
            });
            accountLogic.Withdraw(
                new BankAccountLiquidizeSRO
            {
                GuidAccount = acc1.Guid,
                Value       = 6
            });
            return(View(accountLogic.ViewAccounts(updated_customer.Guid)));

            return(View(customerLogic.ViewCustomer(updated_customer.Guid)));
        }