Beispiel #1
0
        public void RegistrarPedidosNaFila(Dictionary <int, int> dicItensPedidos)
        {
            StorageItemPedido storageItem = new StorageItemPedido();

            try
            {
                if (storageItem.Count() > 0)
                {
                    storageItem.ExcluirTodos();
                }

                foreach (KeyValuePair <int, int> item in dicItensPedidos)
                {
                    storageItem.Incluir(new ItemPedido()
                    {
                        ProdutoId  = item.Key,
                        Quantidade = item.Value
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public async Task <bool> RealizarPedido()
        {
            StorageItemPedido storageItem = new StorageItemPedido();

            try
            {
                Pedido pedido = await service.RealizarPedido(storageItem.Listar(), storage.Consultar().Id);

                if (pedido.Id != 0)
                {
                    storageItem.ExcluirTodos();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }