public RotationTaskListItemViewModel Create(RotationTaskEditModel editModel)
        {
            Rotation rotation = new Rotation()
            {
                OperatorTask  = _taskDAO.Get(editModel.OperatorTaskId),
                AssistantTask = _taskDAO.Get(editModel.AssistantTaskId)
            };

            Task task = new Task()
            {
                CultureName            = editModel.SelectedCultureName,
                Title                  = editModel.Title,
                AllowedExposureMinutes = 0,
                NoiseLevelGuideline    = 0,
                TaskDefinition         = _taskDefinitionDAO.Load(editModel.TaskDefinitionId),
                Role            = _roleDAO.Get("Rotation", Thread.CurrentThread.CurrentCulture.Name),
                NoiseProtection = rotation.OperatorTask.NoiseProtection
            };

            rotation.Task = task;

            _rotationDAO.Store(rotation);

            RotationTaskListItemViewModel viewModel = CreateTableRowViewModel(rotation);

            return(viewModel);
        }
        public ActionResult Edit(int id, RotationTaskEditModel editModel)
        {
            if (editModel.IsValid() == false)
            {
                Response.StatusCode = 500;
                return(PartialView("_ValidationErrorSummary", new ValidationErrorSummaryViewModel(editModel.GetValidationErrors())));
            }

            RotationTaskListItemViewModel viewModel = _rotationTaskService.Edit(id, editModel);

            return(View("_RotationTaskTableRow", viewModel));
        }
        public RotationTaskListItemViewModel Edit(int id, RotationTaskEditModel editModel)
        {
            Rotation rotation = _rotationDAO.Get(id);

            rotation.OperatorTask     = _taskDAO.Get(editModel.OperatorTaskId);
            rotation.AssistantTask    = _taskDAO.Get(editModel.AssistantTaskId);
            rotation.Task.Title       = editModel.Title;
            rotation.Task.CultureName = editModel.SelectedCultureName;

            _rotationDAO.Store(rotation);

            RotationTaskListItemViewModel viewModel = CreateTableRowViewModel(rotation);

            return(viewModel);
        }