public IActionResult CreateViagem()
        {
            var automovels = _automovelService.FindAll();
            var motoristas = _motoristaService.FindAll();
            var viewModel  = new ViagemFormViewModel {
                Automovels = automovels, Motoristas = motoristas
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public IActionResult EditViagem(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var obj = _viagemService.FindById(id.Value);

            if (obj == null)
            {
                return(NotFound());
            }

            List <Automovel>    automovels = _automovelService.FindAll();
            List <Motorista>    motoristas = _motoristaService.FindAll();
            ViagemFormViewModel viewModel  = new ViagemFormViewModel {
                Viagem = obj, Automovels = automovels, Motoristas = motoristas
            };

            return(View(viewModel));
        }