Beispiel #1
0
        public ActionResult ConfirmaReserva(Pagamento pgto)
        {
            var campoAluguelTD = TempData["CampoAluguel"] as CampoAluguel;

            TempData.Keep();
            var queryPagamento = new QueryUsuarioConsumidor();

            if (string.IsNullOrEmpty(pgto.formaPagamento))
            {
                ViewBag.AluguelID = campoAluguelTD.aluguelId;
                return(View("ValidacaoPagamento"));
            }

            if (ModelState.IsValid)
            {
                var aluguelConfirmado = new Aluguel {
                    idAluguel   = campoAluguelTD.aluguelId,
                    idPagamento = (queryPagamento.ListarIdPagamento() + 1),
                    confirmado  = true
                };
                queryPagamento.InserirPagamento(pgto);
                queryPagamento.ConfirmarAluguel(aluguelConfirmado);

                return(View("SucessoReserva"));
            }

            return(View());
        }