public void Post(ObjetivoAlunos objetivoaluno)
 {
     try
     {
         _objetivoalunoRepository.Adicionar(objetivoaluno);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #2
0
 public void Adicionar(ObjetivoAlunos objetivoaluno)
 {
     try
     {
         _ctx.ObjetivoAlunos.Add(objetivoaluno);
         _ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public void Put(Guid id, ObjetivoAlunos objetivoaluno)
 {
     try
     {
         objetivoaluno.IdObjetivoAluno = id;
         _objetivoalunoRepository.Editar(objetivoaluno);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #4
0
        public ObjetivoAlunos BuscarPorId(Guid id)
        {
            try
            {
                ObjetivoAlunos objetivoaluno = _ctx.ObjetivoAlunos.Find(id);

                return(objetivoaluno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #5
0
        public void Remover(Guid id)
        {
            try
            {
                ObjetivoAlunos objetivoaluno = BuscarPorId(id);

                if (objetivoaluno == null)
                {
                    throw new Exception("Objetivo não encontrado");
                }

                _ctx.ObjetivoAlunos.Remove(objetivoaluno);
                _ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #6
0
        public void Editar(ObjetivoAlunos objetivoaluno)
        {
            try
            {
                ObjetivoAlunos objetivoalunotemp = BuscarPorId(objetivoaluno.IdObjetivoAluno);

                if (objetivoalunotemp == null)
                {
                    throw new Exception("Objetivo não encontrado");
                }

                objetivoalunotemp.Nota        = objetivoaluno.Nota;
                objetivoalunotemp.DataEntrega = objetivoaluno.DataEntrega;

                _ctx.ObjetivoAlunos.Update(objetivoalunotemp);
                _ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }