public IHttpActionResult Delete(NotaFiscalDeleteCommand notaFiscal) { var validator = notaFiscal.Validar(); if (!validator.IsValid) { return(HandleValidationFailure(validator.Errors)); } return(HandleCallback(() => _notaFiscalService.Delete(notaFiscal))); }
public bool Delete(NotaFiscalDeleteCommand notaFiscais) { notaFiscais.Validar(); var isRemovedAll = true; foreach (var notaFiscalId in notaFiscais.NotaFiscalIds) { var isRemoved = _notaFiscalRepository.Delete(notaFiscalId); // Aqui poderia dar o tramento adequado, armazenado quais ids foram removidos // e quais não forma removidos (e buscar o porquê). // Como é somente um exemplo, vamos somente retornar false (que não foi totalmente concluído) isRemovedAll = isRemoved ? isRemovedAll : false; } return(isRemovedAll); }