public async Task <bool> DeleteRegMunByMunicipality(Guid idMunicipality) { var toDeleteItems = await GetRegMunByMunicipality(idMunicipality); if (toDeleteItems != null && toDeleteItems.Count() > 0) { foreach (var item in toDeleteItems) { _context.Entry(item).State = EntityState.Deleted; } await _context.SaveChangesAsync(); } return(true); }
public async Task DeleteMunicipalityById(Guid id) { await _regionMunicipalitiesRepo.DeleteRegMunByMunicipality(id); Municipality municipality = new Municipality { Id = id }; _context.Entry(municipality).State = EntityState.Deleted; await _context.SaveChangesAsync(); }
public async Task DeleteRegionById(Guid id) { await _regionMunicipalitiesRepo.DeleteRegMunByRegion(id); Region region = new Region { Id = id }; _context.Entry(region).State = EntityState.Deleted; await _context.SaveChangesAsync(); }