public IActionResult GetPorMesaId(int Id) { try { return(new ObjectResult(_vendaRepository.RetornarVendaPorMesaId(Id, CoreNetFramework.Model.Enums.VendaStatus.PENDENTE))); } catch (Exception ex) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Erro ao retornar uma venda." + System.Environment.NewLine + " Detalhes:" + ex.Message); return(BadRequest(ModelState)); } }