public ActionResult Edit(int exerciseId) { var model = new Models.Exercise.EditVM(); var exerciseBll = new Domain.BLL.ExerciseBLL(); var machineBll = new Domain.BLL.MachineBLL(); var loggedUser = Session.GetLoggedUser(); model.Customers = loggedUser.PessoaEmpresas.Select(pe => pe.Empresas).ToList(); model.Exercise = exerciseBll.Get(exerciseId); model.ExerciseTypes = exerciseBll.GetExerciseTypes(); model.ExerciseMuscleGroups = exerciseBll.GetMuscleGroups(); if (model.Exercise == null) { model.Exercise = new Domain.Repository.Exercicios(); } else { model.Exercise.ExercicioEquipamentos = exerciseBll.GetExerciseEquipamentos(exerciseId); } model.Machines = machineBll.GetMachines(loggedUser.PessoaEmpresas); model.MachineTypes = machineBll.GetMachineTypes(); return View(model); }