public JsonResult GetMachines(string filterName)
 {
     var machineBll = new Domain.BLL.MachineBLL();
     var loggedUser = Session.GetLoggedUser();
     var machines = machineBll.GetMachines(loggedUser.PessoaEmpresas, filterName);
     return Json(machines.Select(m => new { ID = m.ID, Name = m.Nome }).ToList(), JsonRequestBehavior.AllowGet);
 }
 //
 // GET: /Machine/
 public ActionResult Index()
 {
     var model = new Models.Machine.IndexVM();
     var loggedUser = Session.GetLoggedUser();
     var machineBll = new Domain.BLL.MachineBLL();
     model.MachineTypes = machineBll.GetMachineTypes();
     return View(model);
 }
 public ActionResult List(int? roomId, int? machineTypeId, string machineName)
 {
     var model = new Models.Machine.ListVM();
     var machineBll = new Domain.BLL.MachineBLL();
     var loggedUser = Session.GetLoggedUser();
     model.Machines = machineBll.GetMachines(loggedUser.PessoaEmpresas, roomId, machineTypeId, machineName);
     model.MachineTypes = machineBll.GetMachineTypes();
     return View(model);
 }
 public ActionResult Edit(int machineId)
 {
     var model = new Models.Machine.EditVM();
     var machineBll = new Domain.BLL.MachineBLL();
     model.MachineTypes = machineBll.GetMachineTypes();
     var loggedUser = Session.GetLoggedUser();
     model.Rooms = new Domain.BLL.RoomBLL().GetRooms(loggedUser.PessoaEmpresas);
     model.Customers = loggedUser.PessoaEmpresas.Select(pe => pe.Empresas).ToList();
     model.Machine = machineBll.Get(machineId);
     if (model.Machine == null)
     {
         model.Machine = new Domain.Repository.Equipamentos();
     }
     return View(model);
 }
        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);
        }