Exemple #1
0
        public async Task <bool> SolicitarReserva(int qtdAssentos)
        {
            Reserva reserva = new Reserva();

            try
            {
                if (storage.Count() > 0)
                {
                    storage.Excluir();
                }

                reserva.UsuarioId         = new StorageUsuario().Consultar().Id;
                reserva.QuantidadePessoas = qtdAssentos;

                reserva = await service.SolicitarReserva(reserva);

                storage.Incluir(reserva);

                if (storage.Count() <= 0)
                {
                    new ApplicationException("Erro desconhecido, tente novamente.");
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                GC.Collect();
            }
        }
Exemple #2
0
        public async Task <bool> Sair()
        {
            try
            {
                StorageConta   storageConta   = new StorageConta();
                StorageReserva storageReserva = new StorageReserva();

                if (storageConta.Count() > 0)
                {
                    await new ContaController().FecharConta();
                }
                else if (storageReserva.Count() > 0)
                {
                    await new ReservaController().CancelarReserva();
                }

                new StorageItemPedido().ExcluirTodos();
                storageReserva.Excluir();
                storageConta.Excluir();
                storage.Excluir();

                if (storage.Count() > 0)
                {
                    new ApplicationException("Erro desconhecido, tente novamente.");
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }