コード例 #1
0
        public IActionResult Post([FromBody] LearningDataDto value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var learningDataId = _learningDataRepo.Add(value);
            var newObject      = _learningDataRepo.Retrieve(learningDataId);

            return(CreatedAtAction(nameof(Get), new { id = newObject.Id }, newObject));
        }
コード例 #2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                // The request was likely forged, unless there is a validation flaw in the front-end
                return(BadRequest());
            }

            // Learning Data should be complete at this point
            _learningDataRepo.Add(LearningData);
            return(OnGet());
        }