Example #1
0
        public async Task <IActionResult> ObterById(int Id)
        {
            if (Id == 0)
            {
                return(BadRequest());
            }

            try
            {
                var response = await veiculosRepository.Get(Id);

                if (response == null)
                {
                    var resultNotFound = new
                    {
                        code        = 20000,
                        totalRecord = 0,
                        data        = ""
                    };
                    return(Ok(resultNotFound));
                }
                else
                {
                    var result = new
                    {
                        code = 20000,
                        data = response
                    };

                    return(Ok(result));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }
Example #2
0
 // GET: Veiculos/Details/5
 public ActionResult Details(int id)
 {
     return(View(_veiculoRepository.Get(id)));
 }