public void Delete(CompanyDetail entity, bool commit = true) { _context.Entry(entity).State = EntityState.Deleted; //_context.CompanyDetails.Remove(entity); if (commit) { var result = SaveAsync().Result; } }
private void DeleteAllRecords() { var records = _context.CompanyDetails.ToList(); foreach (var record in records) { _context.Entry(record).State = EntityState.Deleted; } _context.SaveChanges(); }