public NotificationResult Excluir(Item entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodItem != 0) { if (NotificationResult.IsValid) { _itemRepositorio.Remover(entidade); NotificationResult.Add("Cadastro excluido com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public void Remover(Item item) { if (item.Id <= 0) { throw new IdentificadorIndefinidoExcecao(); } _repositorio.Remover(item.Id); }