public IComandResult Handle(AlterarOcorrenciaCommands comand) { //verificar se tem notificação no comand if (!comand.IsValid()) { return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications)); } var ocorrencia = _repository.Existe(comand.OcorrenciaId); if (ocorrencia != null) { ocorrencia.Alterar(comand.Titulo, comand.Descricao, comand.DataOcorrencia, comand.AlunoId, comand.Periodo, comand.SerieId, comand.TipoOcorrenciaId, comand.FuncionarioId); _repository.Alterar(ocorrencia); } else { return(new ComandResult(false, "Ocorrencia não existe,tente novamente!!", new { })); } return(new ComandResult(true, "Dados Alterados com Sucesso!!", new { })); }