예제 #1
0
        public async Task <AccountDTO> Handle(long id, Guid ownerId)
        {
            AccountDTO accountForClose = await _accountsService.GetAccountById(id);

            if (!accountForClose.Owner_id.Equals(ownerId))
            {
                throw new Exception("The account you are trying to close is not yours!");
            }
            if (Math.Abs(accountForClose.Amount) == 0)
            {
                return(await _accountsService.CloseAccount(id, ownerId));
            }
            else
            {
                throw new Exception("Your account is not empty or you have debt on this account!");
            }
        }
예제 #2
0
        public async Task <IHttpActionResult> Close(long id)
        {
            var vm = await _accountsService.CloseAccount(TenantId, UserId, id);

            return(Ok(vm));
        }