コード例 #1
0
        /*
         * /
         * /Recebe um id de Restaurante
         * /passa este id para a função
         * /que retorna todos os produtos
         * /disponíveis deste restaurante
         * /
         */
        public async Task <IActionResult> Cardapio(int?id)
        {
            try
            {
                int userlogado = (int)_httpcontext.HttpContext.Session.GetInt32(Sessao.LOGADO);
                if (id == null)
                {
                    return(NotFound());
                }
                else
                {
                    List <Produto> produtos = await _funcService.FindAllProdsByRestAsync(id.Value);

                    if (produtos == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        return(View(produtos));
                    }
                }
            }
            catch
            {
                return(View("~/Views/Login/Index.cshtml"));
            }
        }