public IComandResult Handle(AlterarHorarioRotinaCommands comand) { //verificar se tem notificação no comand if (!comand.IsValid()) { return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications)); } var horarioRotina = _repository.Existe(comand.HorarioRotinaId); if (horarioRotina != null) { var rotina = _rotinaRepository.Existe(horarioRotina.RotinaId, true); if (rotina != null) { horarioRotina.Alterar(comand.Conteudo, comand.DiaSemanaId); _repository.Alterar(horarioRotina); } else { return(new ComandResult(false, "Não existe nenhuma rotina associado a esse horário!!", new { })); } } else { return(new ComandResult(false, "HorárioRotina não existe,tente novamente!!", new { })); } return(new ComandResult(true, "Dados Alterados com Sucesso!!", new { })); }
public IComandResult Handle(AlterarRotinaCommands comand) { //verificar se tem notificação no comand if (!comand.IsValid()) { return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications)); } var rotina = _repository.Existe(comand.RotinaId, comand.UsuarioId); if (rotina != null) { rotina.Alterar(comand.De, comand.Ate, comand.SerieId); _repository.Alterar(rotina); } else { return(new ComandResult(false, "Rotina não encontrada!!,tente novamente!!", new { })); } return(new ComandResult(true, "Dados Alterados com Sucesso!!", new { })); }