public NovaPessoaNovaReservaResponse CriarNovaPessoaEReserva(NovaPessoaNovaReservaRequest request) { NovaPessoaNovaReservaResponse response = new NovaPessoaNovaReservaResponse(); using (ITransactionContext tc = _transactionContextFactory.Begin()) { var handlePessoa = _pessoasDao.CriarPessoaSemRegraNegocio(request.Nome, request.Cpf, request.Email, request.TelefoneMovel); var reserva = _reservasDao.Create(); reserva.PessoaHandle = handlePessoa; reserva.ModeloCarroHandle = request.HandleModeloCarro; reserva.PlanoHandle = request.HandlePlano; reserva.DataInicio = request.DataInicio; reserva.DataFim = request.DataFim; reserva.DataSolicitacao = DateTime.Now; _reservasDao.Save(reserva); response.HandleReservaCriada = reserva.Handle; response.HandlePessoaCriada = handlePessoa; tc.Complete(); } return(response); }
public NovaReservaResponse CriarNovaReserva(NovaReservaRequest request) { NovaReservaResponse response = new NovaReservaResponse(); var reserva = _reservasDao.Create(); reserva.ModeloCarroHandle = request.HandleModeloCarro; reserva.PessoaHandle = request.HandlePessoa; reserva.PlanoHandle = request.HandlePlano; reserva.DataInicio = request.DataInicio; reserva.DataFim = request.DataFim; _reservasDao.Save(reserva); response.HandleReservaCriada = reserva.Handle; return(response); }