Exemplo n.º 1
0
        public Response<Account> DeleteAccount(DeleteAccountRequest request)
        {
            var response = new Response<Account>();
            var accountToDelete = request.Account;

            try
            {

                if (accountToDelete == null)
                {
                    response.Success = false;
                    response.Message = "Account Not Found!";
                }
                else
                {
                    var repo = new AccountRepository();
                    repo.DeleteAccount(accountToDelete);
                    response.Success = true;
                }

            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Exemplo n.º 2
0
        public void Execute()
        {
            string getAccountNum = GetAccounttoDelete();
            var ops = new AccountOperations();
            var accountToDelete = ConverNumberToAccount(getAccountNum);

            var request = new DeleteAccountRequest()
            {
                Account  = accountToDelete
            };

            var response = ops.DeleteAccount(request);

            if (response.Success)
            {
                Console.Clear();
                Console.WriteLine("Account Deleted");
                UserInteractions.PressKeyToContinue();
            }
            else
            {
                Console.Clear();
                Console.WriteLine("An Error Occured:  {0}", response.Message);
                UserInteractions.PressKeyToContinue();
            }
        }