示例#1
0
        public IComandResult Handle(AtivarDesativarCommands comand)
        {
            var r = new List <string>();

            //verificar se tem notificação no comand
            if (!comand.IsValid())
            {
                return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications));
            }

            var funcionario = _repository.Existe(comand.Id);

            if (funcionario != null)
            {
                funcionario.AtivarDesativar();
                this._repository.Alterar(funcionario);

                if (funcionario.Status)
                {
                    return(new ComandResult(true, funcionario.Nome + " foi ativado!!", new { r }));
                }
                else
                {
                    return(new ComandResult(true, funcionario.Nome + " foi desativado!!", new { r }));
                }
            }
            else
            {
                return(new ComandResult(false, "Funcionário não encontrado,tente novamente!!", new { r }));
            }
        }
示例#2
0
        public IComandResult Handle(AtivarDesativarCommands comand)
        {
            var r = new List <string>();

            //verificar se tem notificação no comand
            if (!comand.IsValid())
            {
                return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications));
            }

            var disciplina = _repository.Existe(comand.Id);

            if (disciplina != null)
            {
                disciplina.AtivarDesativar();
                this._repository.Alterar(disciplina);

                if (disciplina.Status)
                {
                    return(new ComandResult(true, disciplina.Nome + " foi ativado(a)!!", new { r }));
                }
                else
                {
                    return(new ComandResult(true, disciplina.Nome + " foi desativado(a)!!", new { r }));
                }
            }
            else
            {
                return(new ComandResult(false, "Disciplina não encontrado,tente novamente!!", new { r }));
            }
        }
示例#3
0
        public IComandResult Handle(AtivarDesativarCommands 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.Id);

            if (rotina != null)
            {
                rotina.AtivarDesativar();
                this._repository.Alterar(rotina);

                if (rotina.Status)
                {
                    return(new ComandResult(true, "Rotina ativada com sucesso !!", new { }));
                }
                else
                {
                    return(new ComandResult(true, "Rotina excluída com sucesso!!", new { }));
                }
            }
            else
            {
                return(new ComandResult(false, "Funcionário não encontrado,tente novamente!!", new { }));
            }
        }
示例#4
0
        public IComandResult Handle(AtivarDesativarCommands comand)
        {
            var r = new List <string>();

            //verificar se tem notificação no comand
            if (!comand.IsValid())
            {
                return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications));
            }

            var turma = _repository.Existe(comand.Id);

            if (turma != null)
            {
                turma.AtivarDesativar();
                this._repository.Alterar(turma);

                if (turma.Status)
                {
                    return(new ComandResult(true, "Turma foi ativada!!", new { r }));
                }
                else
                {
                    return(new ComandResult(true, " Turma foi excluída com sucesso!!", new { r }));
                }
            }
            else
            {
                return(new ComandResult(false, "Turma não encontrada,tente novamente!!", new { r }));
            }
        }
示例#5
0
        public IComandResult Handle(AtivarDesativarCommands comand)
        {
            //verificar se tem notificação no comand
            if (!comand.IsValid())
            {
                return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications));
            }

            var aluno = _repository.Existe(comand.Id);

            if (aluno != null)
            {
                aluno.AtivarDesativar();
                this._repository.Alterar(aluno);

                if (aluno.Status)
                {
                    return(new ComandResult(true, aluno.Nome + " foi ativado!!", new { }));
                }
                else
                {
                    return(new ComandResult(true, aluno.Nome + " foi desativado!!", new { }));
                }
            }
            else
            {
                return(new ComandResult(false, "Aluno não encontrado,tente novamente!!", new { }));
            }
        }
示例#6
0
        public IComandResult AtivarDesativar([FromBody] AtivarDesativarCommands command)
        {
            try
            {
                //var user = Guid.Parse(this.User.Identity.Name);
                var result = _alunoHandler.Handle(command);

                this.Commit(result.Success);
                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }