Пример #1
0
        public CreateResponse CreateAccount(CreateRequest request)
        {
            CreateResponse response = new CreateResponse();

            try
            {
                // Create new account object
                Account newAccount = new Account(request.Balance);

                // Add our new object to pending for pesistence.
                _accountRepository.Add(newAccount);

                // Persist our changes to database.
                _unitOfWork.Commit();
            }
            catch (Exception)
            {
                response.IsSuccessful = false;
                response.Message = "Unable to create account! If problem persist, please contact system administrator.";
                return response;
            }

            response.IsSuccessful = true;
            response.Message = "Account created.";
            return response;
        }
Пример #2
0
        // GET: Home
        public ActionResult Index()
        {
            decimal balance = 1000m;
            CreateRequest createRequest = new CreateRequest();
            createRequest.Balance = balance;

            CreateResponse response = _accountService.CreateAccount(createRequest);
            return View();
        }