示例#1
0
        public IActionResult Update([FromBody] ScenarioRequest scenario)
        {
            var scenarioModel = scenario.ToScenarioModel();

            // Assign new serial number to indicate the scenario has changed to the player
            scenarioModel.SerialNumber = _scenarioCoreController.GetNewSerialNumber();
            scenarioModel = _scenarioCoreController.Update(scenarioModel, true);
            var scenarioContract = scenarioModel.ToScenarioContract();

            return(new ObjectResult(scenarioContract));
        }
示例#2
0
        public IActionResult Create([FromBody] ScenarioRequest newStory)
        {
            var scenario = newStory.ToScenarioModel();

            // Assign new serial number to indicate the scenario has changed to the player
            scenario.SerialNumber = _scenarioCoreController.GetNewSerialNumber();
            if (scenario.Comment == null)
            {
                scenario.Comment = "";
            }
            _scenarioCoreController.Create(scenario, true);
            var scenarioContract = scenario.ToScenarioContract();

            return(new ObjectResult(scenarioContract));
        }