Exemplo n.º 1
0
        public void RemoveById(int id)
        {
            var candidate = _context.Candidates
                            .Include(p => p.Users)
                            .FirstOrDefault(p => id == p.Id);

            if (candidate != null)
            {
                _context.Remove(candidate);
                _context.SaveChanges();
            }
        }
 public void Delete(int id)
 {
     _candidateContext.Remove <Candidate>(_candidateContext.Find <Candidate>(id));
     _candidateContext.SaveChanges();
 }