public void UpdateObjective(ObjectiveEditorViewModel viewModel, ObjectivePart objectivePart)
        {
            foreach (var objectiveResultPreset in objectivePart.ObjectiveResultPresets)
            {
                _objectiveResultPresetRepository.Delete(objectiveResultPreset);
            }
            objectivePart.ObjectiveResultPresets.Clear();

            for (int i = 0; i < viewModel.ObjectiveResultPresets.Count; i++)
            {
                var objectiveResultPreset = viewModel.ObjectiveResultPresets[i];

                var newPreset = new ObjectiveResultPresetRecord
                {
                    DisplayName         = objectiveResultPreset.DisplayName,
                    Points              = objectiveResultPreset.Points,
                    Position            = i,
                    ObjectivePartRecord = objectivePart.Record,
                };

                _objectiveResultPresetRepository.Create(newPreset);

                objectivePart.ObjectiveResultPresets.Add(newPreset);
            }

            var game = _gameService.Get(viewModel.GameId);

            objectivePart.Game = game.Record;
        }
Beispiel #2
0
 public ObjectiveResultPart Approve(ActionSubmitPart submit, ObjectiveResultPresetRecord preset)
 {
     return(Approve(submit, preset.DisplayName, preset.Points));
 }