Example #1
0
        public async Task <bool> DeleteAccount(Account obj)
        {
            var userName = User.Identity.Name;

            var user = await _portfolioService.GetUser(userName);

            if (user != null)
            {
                // check for account
                var account = user.Accounts.Find(x => x.AccountId == obj.AccountId);

                if (account != null)
                {
                    await _portfolioService.DeleteAccount(account.AccountId);

                    return(true);
                }
            }
            return(false);
        }