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; } }
public async Task <bool> AtivarReserva(int nmrMesa, string senhaDaMesa) { try { Reserva reserva = storage.Consultar(); reserva.MesaId = nmrMesa; Conta conta = await service.AtivarReserva(reserva, senhaDaMesa); StorageConta storageConta = new StorageConta(); if (storageConta.Count() > 0) { storageConta.Excluir(); } storageConta.Incluir(conta); reserva.Status = "Em Uso"; storage.Alterar(reserva); return(true); } catch (Exception ex) { throw ex; } }