Exemple #1
0
        public async Task <bool> RequestAccountDelete(Guid accountId)
        {
            _logger.LogInformation("Requesting account delete for account with id: " + accountId);
            try
            {
                var account = await _context.CustomerAccounts.Where(a => a.Id == accountId && a.IsActive == true).FirstOrDefaultAsync();

                if (account != null)
                {
                    account.IsDeleteRequested = true;

                    _context.CustomerAccounts.Update(account);

                    await _context.SaveChangesAsync();

                    _logger.LogInformation("Succesfully requested account deletion for account with id: " + accountId);
                    return(true);
                }
            }
            catch (Exception e)
            {
                _logger.LogError("Exceptions when requesting deletion for account with id : " + accountId + e + e.StackTrace);
            }
            return(false);
        }