public HelicopterTaskViewModel EditNoiseProtectionForm(int id) { var helicopterTask = _helicopterTaskDAO.Get(id); var viewModel = new HelicopterTaskViewModel { Id = helicopterTask.Id }; viewModel.Helicopters.Add(new SelectOptionViewModel(TaskResources.SelectOne, "0")); foreach (var type in _helicopterTypeDAO.GetAll()) { viewModel.Helicopters.Add(new SelectOptionViewModel(type.Title, type.Id.ToString(CultureInfo.InvariantCulture)) { IsSelected = (type.Id == helicopterTask.HelicopterType.Id) }); } viewModel.Tasks.Add(new SelectOptionViewModel(TaskResources.SelectOne, "0")); foreach (var task in _taskDAO.GetAll().Where(task => task.Role.RoleType == RoleTypeEnum.Helideck || task.Role.RoleType == RoleTypeEnum.Helipassenger)) { viewModel.Tasks.Add(new SelectOptionViewModel(task.Title, task.Id.ToString(CultureInfo.InvariantCulture)) { IsSelected = (task.Id == helicopterTask.Task.Id) }); } viewModel.NoiseLevel = helicopterTask.NoiseLevel; return(viewModel); }
public HelicopterTaskViewModel CreateNoiseProtectionForm() { var viewModel = new HelicopterTaskViewModel(); viewModel.Helicopters.Add(new SelectOptionViewModel(TaskResources.SelectOne, "0")); foreach (var type in _helicopterTypeDAO.GetAll()) { viewModel.Helicopters.Add(new SelectOptionViewModel(type.Title, type.Id.ToString(CultureInfo.InvariantCulture))); } viewModel.Tasks.Add(new SelectOptionViewModel(TaskResources.SelectOne, "0")); foreach (var task in _taskDAO.GetAll().Where(task => task.Role.RoleType == RoleTypeEnum.Helideck || task.Role.RoleType == RoleTypeEnum.Helipassenger)) { viewModel.Tasks.Add(new SelectOptionViewModel(task.Title, task.Id.ToString(CultureInfo.InvariantCulture))); } return(viewModel); }
public ActionResult Edit(int id) { HelicopterTaskViewModel viewModel = _helicopterTaskService.EditNoiseProtectionForm(id); return(PartialView("_EditHelicopterTask", viewModel)); }
public ActionResult Create() { HelicopterTaskViewModel viewModel = _helicopterTaskService.CreateNoiseProtectionForm(); return(PartialView("_CreateHelicopterTask", viewModel)); }