public IActionResult Details(ComandaProduto p) { int id = p.Id; var comandaproduto = _comandaProdutoService.ToListProdutos(id); if (comandaproduto == null) { return(NotFound()); } return(View(comandaproduto)); }
public static List <ComandaProduto> getComandaProduto() { List <ComandaProduto> lc = new List <ComandaProduto>(); int conta = Convert.ToInt32(HttpContext.Current.Session["conta"]); //Fazer os InnerJoins pra pegar o nome do Usuário que fez o pedido command.CommandType = CommandType.Text; command.CommandText = string.Format("SELECT id_Comanda_Produto, qtd_Item_Comanda, fk_idProduto, fk_idComanda, status_ComandaProduto, fk_idConta FROM Comanda_Produto WHERE fk_idConta = {0} AND status_ComandaProduto = 1", conta); try { con.Open(); command.ExecuteNonQuery(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int idComandaProduto = reader.GetInt32(0); int qtdeItemComanda = reader.GetInt32(1); int fk_idProduto = reader.GetInt32(2); int fk_idComanda = reader.GetInt32(3); int status_ComandaProduto = reader.GetInt32(4); int fk_idConta = reader.GetInt32(5); ComandaProduto cp = new ComandaProduto(idComandaProduto, qtdeItemComanda, fk_idProduto, fk_idComanda, status_ComandaProduto, fk_idComanda); lc.Add(cp); } return(lc); } finally { con.Close(); } }