Пример #1
0
        public void Delete(int id)
        {
            try
            {
                var cc = Get(id);

                if (cc == null)
                {
                    throw new Exception("Conta Corrente not found to delete");
                }

                _context.ContaCorrentes.Remove(cc);

                _auditService.Save(new AuditEvent {
                    CreatedDate = DateTime.Now, Action = "Delete", Entity = "CC", Id = id
                });
            }
            catch (AppException)
            {
                throw new AppException("CC cannot be deleted");
            }
        }
Пример #2
0
        public void Delete(int id)
        {
            try
            {
                var lancamento = Get(id);

                if (lancamento == null)
                {
                    throw new Exception("Lancamento not found to delete");
                }

                _context.Lancamentos.Remove(lancamento);

                _auditService.Save(new AuditEvent {
                    CreatedDate = DateTime.Now, Action = "Delete", Entity = "Lancamento", Id = id
                });
            }
            catch (AppException)
            {
                throw new AppException("Lancamento cannot be deleted");
            }
        }