public IActionResult GetById(int id)
        {
            try
            {
                var materiaPrima = _repoMateriaPrima.Selecionar(id);
                if (materiaPrima == null)
                {
                    return(BadRequest("Não existe matéria prima com esse Id."));
                }

                return(Ok(_mapper.Map <MateriaPrimaDto>(materiaPrima)));
            }
            catch (System.Exception)
            {
                return(StatusCode(500));
            }
        }
Ejemplo n.º 2
0
 public IActionResult Get(int id)
 {
     try
     {
         if (_matRepo == null)
         {
             return(NotFound());
         }
         return(Ok(_matRepo.Selecionar(id)));
     }
     catch (System.Exception)
     {
         return(StatusCode(500));
     }
 }