Example #1
0
        public bool Delete(int id)
        {
            var cliente = _context.Clientes.FirstOrDefault(p => p.Id == id);

            if (cliente == null)
            {
                throw new NotFoundException();
            }
            _context.Entry(cliente).State = EntityState.Deleted;
            return(_context.SaveChanges() > 0);
        }
Example #2
0
 public bool Update(Conta conta)
 {
     _context.Entry(conta).State = EntityState.Modified;
     return(_context.SaveChanges() > 0);
 }