public async Task <IActionResult> ListarTodos() { try { IList <Produtos> listProdutos = await _service.ListarTodos(); return(Ok(listProdutos.ToList())); } catch (Exception ex) { return(UnprocessableEntity(new { ex.Message, Status = 422 })); } }
// GET: Produtos public ActionResult Index() { //return View(db.Produtos.ToList()); return(View(_produtoService.ListarTodos())); }