Ejemplo n.º 1
0
        public void Update(int id, ContaCorrente cc)
        {
            if (id != cc.IDConta)
            {
                throw new Exception("Cannot update with different ids");
            }

            _context.Entry(cc).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();

                _auditService.Save(new AuditEvent {
                    CreatedDate = DateTime.Now, Action = "Update", Entity = "CC", Id = cc.IDConta
                });
            }
            catch (DbUpdateConcurrencyException)
            {
                throw new Exception("Cannot find a cc to upload");
            }
        }
Ejemplo n.º 2
0
        public void Update(int id, Lancamento lancamento)
        {
            if (id != lancamento.Id)
            {
                throw new Exception("Cannot update with different ids");
            }

            _context.Entry(lancamento).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();

                _auditService.Save(new AuditEvent {
                    CreatedDate = DateTime.Now, Action = "Update", Entity = "lancamento", Id = lancamento.ID
                });
            }
            catch (DbUpdateConcurrencyException)
            {
                throw new Exception("Cannot find a lancamento to upload");
            }
        }