コード例 #1
0
        public async Task <ActionResult <MenuItemModel> > Create([FromBody] ObjectiveModel objectiveModel)
        {
            if (!ModelState.IsValid)
            {
                throw new ValidationException("Form validation error");
            }
            var result = await _objectiveService.Create(objectiveModel);

            if (result == null)
            {
                throw new ObjectiveNotFoundException("Cant create objective, parent not found.");
            }
            return(Ok(result));
        }