public async Task DeleteAgregacoes(int id) { foreach (Agregacao a in _agregacaorepo.GetAllAgregacoesByProdutoBaseID(id).Result) { await _agregacaorepo.Delete(a.AgregacaoID); } foreach (Agregacao a in _agregacaorepo.GetAllAgregacoesByProdutoParteID(id).Result) { await _agregacaorepo.Delete(a.AgregacaoID); } }
public async Task <IActionResult> DeleteAgregacao(int id) { var agregacao = await _agregacaoRepository.GetById(id); if (agregacao == null) { return(NotFound()); } await _agregacaoRepository.Delete(id); return(Ok()); }